@bazo/react-layout-route
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

react-layout-route

Route with layout for react & react-router

Usage

//layout.tsx
import { LayoutProps } from "@bazo/react-layout-route";

const Layout = ({ children, ...props }: { children: React.ReactNode } & LayoutProps) => {
	return <div>{children}</div>;
};

//routes.tsx
import WithLayout from "@bazo/react-layout-route";
import Layout from "../components/layout";

const MyLayout = (props: RouteProps) => <WithLayout {...props} layout={Layout} />;

const Routes = () => {
	return (
		<Switch>
			<MyLayout path="/" component={Home} />
		</Switch>
	);
};

Readme

Keywords

none

Package Sidebar

Install

npm i @bazo/react-layout-route

Weekly Downloads

4

Version

1.0.8

License

MIT

Unpacked Size

4.17 kB

Total Files

7

Last publish

Collaborators

  • bazo