|
@ -5,7 +5,7 @@ import produce from 'immer'; |
|
|
import { useState } from 'react'; |
|
|
import { useState } from 'react'; |
|
|
|
|
|
|
|
|
function App() { |
|
|
function App() { |
|
|
const Notes = props => props.data.map(note => <div>{note.text}</div>); |
|
|
/*const Notes = props => props.data.map(note => <div>{note.text}</div>); |
|
|
const initialData = [{ text: 'Hey' }, { text: 'There' }]; |
|
|
const initialData = [{ text: 'Hey' }, { text: 'There' }]; |
|
|
const [data, setData] = useState(initialData); |
|
|
const [data, setData] = useState(initialData); |
|
|
|
|
|
|
|
@ -26,6 +26,22 @@ function App() { |
|
|
<Notes data={data} /> |
|
|
<Notes data={data} /> |
|
|
</div> |
|
|
</div> |
|
|
); |
|
|
); |
|
|
} |
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
const [fName, setfName] = useState(''); |
|
|
|
|
|
|
|
|
|
|
|
const submitValue = () => { |
|
|
|
|
|
const frmdetails = { |
|
|
|
|
|
'First Name' : fName |
|
|
|
|
|
} |
|
|
|
|
|
console.log(frmdetails); |
|
|
|
|
|
}; |
|
|
|
|
|
return( |
|
|
|
|
|
<div className="App"> |
|
|
|
|
|
<input type="text" placeholder="First Name" onChange={e => setfName(e.target.value)} /> |
|
|
|
|
|
<button onClick={()=>submitValue()}>Add note</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export default App; |
|
|
export default App; |
|
|