Answer the question
In order to leave comments, you need to log in
How to wrap a component in React?
Good day.
There is a component <Component prop={value} />
.
There is some function that wraps it
const withWrapper = (ComponentToWrap) => {
return <div className="Wrapper"><ComponentToWrap /></div>
}
import Main from ...
...
render() {
return (
{ withWrapper(Main) }
);
}
...
the proper result cannot be achieved, in the console the following messageWarning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question