Skip to content

Instantly share code, notes, and snippets.

@akramsaouri
Last active September 8, 2020 15:25
Show Gist options
  • Save akramsaouri/a160ec4ca84a8fc01f70b12a11d25569 to your computer and use it in GitHub Desktop.
Save akramsaouri/a160ec4ca84a8fc01f70b12a11d25569 to your computer and use it in GitHub Desktop.
⚛️ Layout wrapping in react router
import React from 'react'
import { Route } from 'react-router-dom'
function RouteWrapper({ component: Component, layout: Layout, ...rest }) {
return (
<Route
{...rest}
render={(props) => (
<Layout {...props}>
<Component {...props} />
</Layout>
)}
/>
)
}
export default RouteWrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment