MCPcopy Create free account
hub / github.com/codemistic/Web-Development / getLocalStorage

Function getLocalStorage

Grocery-Bud/src/App.js:4–11  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import List from './List';
3import Alert from './Alert';
4const getLocalStorage = () => {
5 let list = localStorage.getItem('list');
6 if (list) {
7 return (list = JSON.parse(localStorage.getItem('list')));
8 } else {
9 return [];
10 }
11};
12function App() {
13 const [name, setName] = useState('');
14 const [list, setList] = useState(getLocalStorage());

Callers 1

App.jsFile · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected