React.useEffect(() => {
if (inputRef.current) {
inputRef.current.focus();
}
const data = localStorage.getItem("todos");
if (typeof data === "string") {
setTodos(JSON.parse(data));
}
}, []);
React.useEffect(() => {
localStorage.setItem("todos", JSON.stringify(todos));
}, [todos]);
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
function App() {
return (
<div className="App">
<Router>
<Header /> //Хедер просто к примеру
<Routes>
<Route path="/personal" element={<Personal />} />
</Routes>
</Router>
</div>
);
}