React Router v2.5.1
React v15.1.0
Route config:
<Router history={hashHistory}>
<Route path="auth" component={AuthLayout}>
<Route path="login" components={{main:LoginForm, footer: LoginFooter}} />
<Route path="register" components={{main:RegisterForm, footer: RegisterFooter}} />
</Route>
</Router>
AuthLayout Component
class AuthLayout extends React.Component {
render() {
const { main, footer} = this.props;
return (
<div>
<div>
<div className="content clearfix">
{main}
</div>
</div>
{footer}
</div>
);
}
}
export default AuthLayout;
Question - how do you pass props to the AuthLayout component from React Router where there are multiple components i.e. dependent on the component for {main} a different props should be passed.
I am fairly new to react so if I am approaching this incorrectly please advise. I have researched this topic but many of the solutions seemed out of date and did not take into account when multiple components can be loaded.