Frontendx
Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Plugins
Installed
react@^19.2.0
react-dom@^19.2.0
Editor
Render Props Pattern
Description
Implement a MouseTracker component using the render props pattern to track mouse position.
Example 1:
<MouseTracker render={(x, y) => (
<p>Mouse is at {x}, {y}</p>
)} />
Example 2:
<MouseTracker>
{(x, y) => <div style={{position: 'absolute', left: x, top: y}}>●</div>}
</MouseTracker>
Constraints
- Create a MouseTracker component that tracks mouse position
- Use render props pattern - accept a function as children or render prop
- Pass x and y coordinates to the render function
- Track mousemove events on window or document
- Clean up event listener on unmount
Render prop is a function prop that tells component what to render
Preview
Terminal
Test Results
Render Props Pattern
Implement the render props pattern to share component logic using a function prop.