class RenderPropComponent extends Component {
render() {
const { renderLogic } = this.props;
return (
<div>
<h1>Render Prop Example</h1>
{renderLogic("Hello from RenderPropComponent!")}
</div>
);
}
}
class App extends Component {
render() {
return (
<div>
<RenderPropComponent
renderLogic={(content) => <p>{content}</p>}
/>
</div>
);
}
}
export default App;
Explain how the `RenderPropComponent` communicates the "Hello from RenderPropComponent!" content to be rendered.
Assume: All imports are done.
The content is directly specified in the `render` prop.
The `App` component uses a Redux store to pass the content.
The `RenderPropComponent` fetches the content from an external API.
The `App` component passes the renderLogic function which can receive the content passed by RenderPropComponent and display it.
To get all Infosys Certified React Expert Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee