FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Modal Dialog

15 mins

Build a reusable Modal dialog component in React.

Requirements:

  1. The modal should have an open and close state.
  2. Provide a button to open the modal.
  3. Provide a button inside the modal to close it.
  4. The modal should accept children as content.
  5. Should be reusable in different parts of the app.
  6. Focus on functionality over styling.
  7. The component should work out-of-the-box in a live React preview (e.g., CodeSandbox/Sandpack).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component