You can use this.props.children
to render whatever children the component contains:
const Wrap = ({ children }) => <div>{children}</div>
export default () => <Wrap><h1>Hello word</h1></Wrap>
More Related Contents:
- Unable to access React instance (this) inside event handler [duplicate]
- Why do we need middleware for async flow in Redux?
- Push method in React Hooks (useState)?
- Rendering raw html with reactjs
- How do I conditionally add attributes to React components?
- Why can’t I update props in react.js?
- Correct way to handle conditional styling in React
- Intercept/handle browser’s back button in React-router?
- Is it possible to share states between components using the useState() hook in React?
- react router doesn’t work in aws s3 bucket
- React Routing works in local machine but not Heroku
- How do you send images to node js with Axios?
- When to use JSX.Element vs ReactNode vs ReactElement?
- Sending Request body for GET method in AXIOS throws error
- Recommended way of making React component/div draggable
- React: why child component doesn’t update when prop changes
- How to store Configuration file and read it using React
- React: trigger onChange if input value is changing by state?
- Is store.dispatch in Redux synchronous or asynchronous
- How do I setState for nested object?
- First Load JS shared by all is rather heavy in next.js
- useEffect is running twice on mount in React
- React – useState – why setTimeout function does not have latest state value?
- How to create a protected route with react-router-dom?
- “You may need an additional loader to handle the result of these loaders.”
- Uncaught Invariant Violation: Rendered more hooks than during the previous render
- How to mock React component methods with jest and enzyme
- Class based component vs Functional components what is the difference ( Reactjs ) [duplicate]
- value of using React.forwardRef vs custom ref prop
- create-react-app is showing all my code in production, how to hide it?