react-location-handler
v1.1.6
Published
A lightweight React hook to conditionally render components based on current routes.
Maintainers
Readme
React Location Handler
A lightweight React hook to conditionally render components based on current routes.
Installation
npm install react-location-handler
import { useHandleLocation } from 'react-location-handler';
const AppContent = ()=> {
const { Hide , Show } = useHandleLocation(['/login' , '/signup' , '/404']);
return (
<>
{Hide([], <Navbar />)}
<Routes>
<Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/register" element={<Register />} />
</Routes>
{Show([], <Footer />)}
</>
);
};
