Qtr No. 213, New Town Yehlanka Indore 454775
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 Group https://bit.ly/infy_premium_group
We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.
Qtr No. 213, New Town Yehlanka Indore 454775
admin@prepflix.in