@lolaevaSubmitted almost 2 years ago
wdbyb
@wdbybAll comments
- @wdbybPosted almost 2 years ago
Cannot go further the login screen. Maybe it's just something on my side.
1 - @MladenAnticSubmitted almost 2 years ago
If someone knows how to save properly in local storage and keep the list updated on reload with my code as is, I would be very grateful!
@wdbybPosted almost 2 years agoHello there! Here is my solution that I honestly pickep up on https://youtu.be/a_7Z7C_JCyo?t=16632 You're interesting in "Grocery-Bud Local Storage" part of video (if something goes wrong with the link)
const getLocaleStorage = () => { let todos = localStorage.getItem('todos'); if (todos) { return JSON.parse(todos); } return []; }; const App = () => { const [buttons, setButtons] = useState( getLocaleStorage() ); ... useEffect(() => { localStorage.setItem('todos', JSON.stringify(buttons)); }, [buttons]); };
0