简体   繁体   English

React组件未在父级中呈现

[英]React component not rendering in the parent

I'm trying to render Justin.js into, Home.js (see screenshot below). 我正在尝试将Justin.js渲染为Home.js(请参见下面的屏幕截图)。 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. 这不是我第一次使用React.js,所以我不明白为什么当我将其作为元素包含在父级中时,它没有呈现。 My route is defined properly as well, because it does render the static markup in Home.js perfectly fine. 我的路由也已正确定义,因为它确实可以很好地呈现Home.js中的静态标记。 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 我正在使用服务器端渲染,但除此页面外,我在所有其他页面上都工作正常(请检查我的Github中用于样板的链接,该链接使用https://github.com/js1599/gulp 。任何帮助将不胜感激,被困在这里一天

Screenshot: 屏幕截图: Scrrenshot

The issue was that the className of "who" can't be reference to by it's name while within another file. 问题是当在另一个文件中时,“ who”的className不能被其名称引用。 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. 请参阅下面的屏幕截图。 在此处输入图片说明

Here's Another Screenshot for more explanation 这是另一个截图以获取更多说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React组件不呈现来自父级的道具 - React component not rendering props coming from parent React hooks:父组件不重新渲染 - React hooks: Parent component not re-rendering FlatList没有在React Native的子组件中呈现父组件数据 - FlatList not rendering parent component data in child component in React Native React子组件不会在父状态更改时重新呈现 - React child component not re-rendering on parent state change 反应子组件不会在更新的父状态上重新渲染 - React child component not re-rendering on updated parent state 反应道具不会在父组件中呈现,甚至在同一组件中也不会呈现 - react prop not rendering in parent component and even in the same one 在父 state 更改后反应子组件不重新渲染 - React children component not re-rendering after parent state changes 反应子组件不会在父强制更新时重新渲染 - React child component not re-rendering on parent force update React Hooks (Rendering Arrays) - 父组件持有映射的子组件的引用与父组件持有 state 的子组件 - React Hooks (Rendering Arrays) - Parent component holding a reference of children that are mapped vs Parent component holding the state of children 如何在不渲染子组件的情况下根据子组件的大小更改React父组件的大小? - How to change React parent component size based on child component size without rendering child component?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM