Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Installed
react@^19.2.0
react-dom@^19.2.0

Functional Modal Component in ReactJS

Prompt

Build a reusable functional modal dialog component. Accepts title, body content, and footer (action buttons) as props or children. Renders with a semi-transparent backdrop. Closes on backdrop click or a close button. Must be composable so any content can be placed inside it.

Use isOpen boolean state. Render modal conditionally. Backdrop is a full-screen fixed div with onClick that closes modal. Add onClick stopPropagation on modal container so clicking inside doesn't bubble to backdrop.
Test Results

Functional Modal Component in ReactJS

Build a reusable functional modal dialog component. Accepts title, body content, and footer (action buttons) as props or children. Renders with a semi-transparent backdrop. Closes on backdrop click or a close button. Must be composable so any content can be placed inside it.