0.1.2 • Published 3 years ago
next-router-component v0.1.2
next-router-component
Component-based routing with Next.js
.
Install
npm install next-router-component
Example
const Sample = () => {
return (
<div>
{/* The following two are just different ways of writing */}
<Route<{ id: string | string[] }>
path={'/catch-all/[id]'}
render={({ id }) => <h1>This page is {`/catch-all/${id}`}</h1>}
/>
<Route<{ id: string | string[] }> path={'/catch-all/[id]'}>
{({ id }) => <h1>This page is {`/catch-all/${id}`}</h1>}
</Route>
</div>
);
};