1.2.0 • Published 2 years ago

@sumanabrite/modal-react v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@sumanabrite/modal-react

Responsive modal dialog component for React.

Installation

To install, npm

  • npm install @sumanabrite/modal-react

Example

import { Modal } from '@sumanabrite/modal-react'
import React from 'react'

export default function Form() {
  window.React = React

  const [isValid, setIsValid] = useState(false)
  
  const handleResponse = () => {
    setIsValid(false)
  }

  const handleFormSubmit = (e) => {
    e.preventDefault()
    setIsValid(true)
  }

  return (
    <form className="form" onSubmit={handleFormSubmit}>
      <label>First Name</label>
      <input type="text" name="firstname"onChange={handleFormChange} />
    </form>
      {isValid ? <Modal text="your success text here" handleResponse={handleResponse} /> : ''}
  )
}