Created
January 25, 2019 16:16
-
-
Save brookslybrand/4b7aeb83f65c0a25ef67cc3c2e204f66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react' | |
| import Dexie from 'dexie' | |
| import Form from './Form' | |
| const App = () => { | |
| const [open, setOpen] = useState(true) | |
| return ( | |
| <div style={{ margin: '2rem auto', width: '200px' }}> | |
| <button onClick={() => setOpen(!open)}>{`${ | |
| open ? 'Close' : 'Open' | |
| } Form`}</button> | |
| {/* Pass in a new connection to the database when Form is first rendered */} | |
| {open && <Form db={new Dexie('FormDatabase')} />} | |
| </div> | |
| ) | |
| } | |
| export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment