const Component = React.lazy(() => import('./path/to/component'))
Components that accept other components as props or return other components. [[programming-terms|Higher order functions]]
// App.jsx
const withExtraProps = (component) => {
const Component = component
return function(props) {
return <Component {...props} />
}
}
const App = () => {
return (
<h1>App</h1>
)
}
const AppWithExtra = withExtraProps(App)
export default AppWithExtra