Rinakat225 / Todo-list

0 stars 0 forks source link

App should not be a complex React component, but just an entry point of our application #12

Closed kresimir-coko closed 2 months ago

kresimir-coko commented 2 months ago

https://github.com/Rinakat225/Todo-list/blob/9425613facb42840182d01162eea3856be179630/src/App.js#L11

App.js should just be there to kickstart the React ecosystem and have 1-2 layout-related elements that will handle everything further down the line.

Bytechef's App component as a reference:

function App() {
    const [mobileMenuOpen, setMobileMenuOpen] = useState(false);

    const location = useLocation();

    useGlobalErrorInterceptor();

    useEffect(() => {
        document.title = titles[location.pathname] ?? 'ByteChef';
    }, [location]);

    return (
        <div className="flex h-full">
            <TooltipProvider>
                <MobileSidebar
                    mobileMenuOpen={mobileMenuOpen}
                    navigation={navigation}
                    setMobileMenuOpen={setMobileMenuOpen}
                    user={user}
                />

                <DesktopSidebar navigation={navigation} />

                <div className="flex min-w-0 flex-1 flex-col">
                    <MobileTopNavigation setMobileMenuOpen={setMobileMenuOpen} />

                    <Outlet />
                </div>
            </TooltipProvider>

            <Toaster />
        </div>
    );
}
Rinakat225 commented 2 months ago

Done on commit: https://github.com/Rinakat225/Todo-list/commit/3931dc3578d7f9adbb5c8ac6d62fd3d6dffb975f