I got a page like this. I want use it to wrap other small components and put them in the router. My react router is version 5.0
import styled from 'styled-components'
import Footer from '../footer/Footer'
import Header from '../header/Header'
const PageWrap: any = ({ children }) => {
return (
<>
<Header />
<div className="other-small-comp">{children}</div>
<Footer />
</>
)
}
export default PageWrap
With a function PageWrap, I want to be able to do something like this in the route
import Account from './Account'
Import Login from './Login'
<Switch>
<PrivateRoute path={urls.account} exact component={PageWrap(Account)} />
<Route path={urls.login} exact component={Login} />
</Switch>
How can I do PageWrap(Account) without error ?