score:0
Accepted answer
you are never rendering <hord>
, if a component is never rendered, it won't render what's inside it.
in your index.js, you probably have code that looks like this:
import { strictmode } from "react";
import reactdom from "react-dom";
import app from "./app";
const rootelement = document.getelementbyid("root");
reactdom.render(
<strictmode>
<app />
</strictmode>,
rootelement
);
this code indicates that the <app>
component will get rendered in the root
element from your index.html.
so starting from the <app>
component, you can build your component tree, because you never call <hord>
, it will never render, nor will the components rendered inside <hord>
.
render <hord>
inside your <app>
component.
import react from 'react'
import hort from './hort'
import hord from './hord'
function app(props) {
const text1 = 'check1'
return (
<hort test1={text1} />
<hord />
);
}
export default app;
as mentioned in the comments, you shouldn't import
components that could cause infinite loops.
import react from 'react'
// * removed imports
function hort(props) {
return (
<div>
<h1>just {props.test1}</h1>
<h2>just {props.test2}</h2>
</div>
)
}
export default hort;
Source: stackoverflow.com
Related Query
- Why do my props not work in grandchild component?
- Why is React component rerendering when props has not changed?
- Why does custom Button component using MUI Button not work on hover with Tooltip?
- Why are my props not being passed into my component when mount rendering?
- Functional Component definition scope causing app to not work correctly, but I can't understand why
- ComponentDidMount does not work - props do not pass to child component
- Why doesn't enzymes find() with component props work the same way when using full rendering or shallow rendering?
- Why React component is not update when the props passed to it changes?
- Why does moving the array map of props outside the render function not work in React?
- Why does passing event handler to child component not work
- React Redux: Why is this nested component not receiving props from redux state?
- Why does this React/Mobx observer component not rerender when its observable props change?
- Why null/undefined checks does not work in Classes with extendable props interface in Typescript
- Why is my method Render Props of the React Component not working?
- Why can I not pass props to child component React?
- Why the following react functional component does not work properly?
- Why my React component handler is executed at render time and will not work afterwhile?
- Why my state is not getting set inside class based component and it should work but it is not neither i am getting error
- Why is the props not passed to my Component in this beginner question
- why is function not being passed as props to onClick of another component
- Why component to not re-render when props change?
- why nested array object not work in react component
- Why my Component is not receiving updated props from Redux Store?
- Why does React component keep logging console statement when not passed any props
- Why props is not working with my child component React JS (react native)
- Why does not the background color get applied from props using state for a styled component div using react and typescript?
- Why does sort not work in React component
- Why is `Promise.then` called twice in a React component but not the console.log?
- Will a stateless component re-render if its props have not changed?
- Why does my React Component Export not work?
More Query from same tag
- React ref & Formik innerRef - current.values doesn't get updated
- Javascript, Type Error : Information.map is not a function || How to use .map?
- React use onChange from parent
- How do I access React component's local state using Cypress?
- Functional test with typescript of store change with async redux-thunk action
- Using React-Bootstrap, how can i keep my Instrument Cards dynamically sized, while still specifying a minimum card size
- How do I modify a button component with className when I importing this component in another component
- React is not rendering when i use react-router
- Touchable opacity on press not working inside SVG tags
- How To Load JSON Into an ag-grid Table (React)?
- How to bind the elements to the modal in React?
- I can't perform a request from ReactJS. The header can not be written correctly
- React: Pass function to child component as props, call onClick in child component
- How to make text to be always aligned even on curved path
- How to re-render react component depends on a file?
- cannot click on a react panel element using Cypres
- setState only setting last input when using object as state
- Cannot read value from axios GET request response outside of axios function
- Shopping cart component not updating with correct quantities
- Difference between : Redux and Relay
- setValue from material UI select
- React: why is a correct file path throwing a'module not found' error when being mapped?
- How to return a list according to selected item?
- Material UI Dialog Component - How to show it?
- React.js: shouldComponentUpdate in array of stateless child Components
- Add / Update Deep Array of Objects in React / Redux
- React useContext not passing value down to deeply nested children
- Run React's useEffect at random intervals
- Location did not match - Nested Routes Not Working
- Error: Target container is not a DOM element