Self-review: Implementing scroller position with render props - Advanced React

Considering the
MousePositioncomponent receives a prop calledrender, which is a function, what are valid options of JSX returned from the component?return render(<div>{mousePosition}</div>);return ( <div> render({mousePosition}) </div> );return render({ mousePosition });
The
PointMouseLoggercomponent returns the below JSX.<p> ({mousePosition.x}, {mousePosition.y}) </p>After incorporating the
MousePositioncomponent as part of the JSX returned byPointMouseLogger, what should be the new JSX thatPointMouseLoggerreturns?return( <MousePosition> {({ mousePosition }) => ( <p> ({mousePosition.x}, {mousePosition.y}) </p> )} </MousePosition> );return( <MousePosition> {({ mousePosition }) => ( <p> ({mousePosition.x}, {mousePosition.y}) </p> )} </MousePosition> );return( <MousePosition render={({ mousePosition }) => ( <p> ({mousePosition.x}, {mousePosition.y}) </p> )} /> );
The App component initially presents the below output structure
function App() { return( <div className="App"> <header className="Header">Little Lemon Restaurant 🍕</header> <PanelMouseLogger /> <PointMouseLogger /> </div> ); }After adding the MousePosition component into the mix, would you still have to perform any changes to the App component?
Yes
No

About the author
A passionate full-stack developer from @ePlus.DEV
Comments
Join the discussionNo comments yet. Be the first to comment.
Advanced React
Learn how to use more advanced React concepts and features, become proficient in JSX, and confidently test your applications.






