Created
October 26, 2018 01:07
This file contains 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 from "react"; | |
import ReactDOM from "react-dom"; | |
import useLocalStorage from "react-use-localstorage"; | |
import "./styles.css"; | |
function App() { | |
const [item, setItem] = useLocalStorage("name"); | |
return ( | |
<div className="App"> | |
<h1>Set Name to store in Local Storage</h1> | |
<div> | |
<label> | |
Name:{" "} | |
<input | |
type="text" | |
placeholder="Enter your name" | |
value={item} | |
onChange={e => setItem("name", e.target.value)} | |
/> | |
</label> | |
</div> | |
</div> | |
); | |
} | |
const rootElement = document.getElementById("root"); | |
ReactDOM.render(<App />, rootElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment