Answer the question
In order to leave comments, you need to log in
How to render a component passed to props?
How to render a component from props? I know about HOC patterns and Render Props, but I haven't used either.
What do I need to do with this code to get my component to render?
// App.js
return (
<BlurBackground loading={loading} component={LoadingComponent}>
<AnotherComponent />
</BlurBackground>
)
// BlurBackground.js
const { loading, children, component } = this.props;
return (
<BlurWrapper loading={true}>
{children}
{component} // Вот этот должен рендериться
</BlurWrapper>
);
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