// ============================================================
// APP — Router root
// ============================================================
function App() {
const route = useHashRoute();
const [, force] = useState(0);
// re-render when storage changes (e.g. cross-tab)
useEffect(() => {
const onStorage = () => force(x => x + 1);
window.addEventListener('storage', onStorage);
return () => window.removeEventListener('storage', onStorage);
}, []);
const [head, second, third] = route.parts;
if (head === 'admin') {
return ;
}
if (head === 'artigo' && second) {
return ;
}
if (head === 'categoria' && second) {
return ;
}
// default → home
return ;
}
ReactDOM.createRoot(document.getElementById('root')).render();