React组件未在父级中呈现

时间:2022-12-24 20:10:28

I'm trying to render Justin.js into, Home.js (see screenshot below). It's not my first go around with React.js, so I dont understand why it's not rendering when I include it as a element in the parent. My route is defined properly as well, because it does render the static markup in Home.js perfectly fine. I am using server side rendering, but I was working just fine on all my other pages except this one (check out the link from my Github for my boiler plate that im using https://github.com/js1599/gulp. Any help would be appreciated, been stuck here for a day

我正在尝试将Justin.js渲染成Home.js(见下面的截图)。这不是我第一次使用React.js,所以当我将它作为父元素包含在内时,我不明白它为什么不渲染。我的路线也被正确定义,因为它确实使Home.js中的静态标记完全正常。我正在使用服务器端渲染,但我在除了这一个之外的所有其他页面上工作得很好(从我的Github查看我的锅炉板的链接,我使用https://github.com/js1599/gulp。任何帮助将不胜感激,被困在这里一天

Screenshot: React组件未在父级中呈现

1 个解决方案

#1


0  

The issue was that the className of "who" can't be reference to by it's name while within another file. So what you have to do is just Import the component as usual, and then use the name you imported it as, as the element name. See Screenshot below. React组件未在父级中呈现

问题是“who”的className在另一个文件中不能通过它的名称引用。所以你要做的就是像往常一样导入组件,然后使用你导入它的名称作为元素名称。见下面的截图。

Here's Another Screenshot for more explanation

这是另一个截图以获得更多解释

React组件未在父级中呈现

#1


0  

The issue was that the className of "who" can't be reference to by it's name while within another file. So what you have to do is just Import the component as usual, and then use the name you imported it as, as the element name. See Screenshot below. React组件未在父级中呈现

问题是“who”的className在另一个文件中不能通过它的名称引用。所以你要做的就是像往常一样导入组件,然后使用你导入它的名称作为元素名称。见下面的截图。

Here's Another Screenshot for more explanation

这是另一个截图以获得更多解释

React组件未在父级中呈现