This repository has been archived by the owner on Sep 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
How to define a route without the CoreLayout props children? #1061
Comments
Hi @onweer, import CoreLayout from '../layouts/CoreLayout/CoreLayout'
import Home from './Home'
import CounterRoute from './Counter'
import Login from './Login'
export const createRoutes = (store) => ([ // now we are passing an array of routes
{
path: '/',
component: CoreLayout,
indexRoute: Home,
childRoutes: [
CounterRoute(store)
]
},
{
path: '/login',
component: Login
},
...
])
... Don't forget to change Also, if you want ...
{
path: '/auth',
component: AuthLayout,
indexRoute: SignIn,
childRoutes: [
SignUpRoute(store), // { path: 'sign-up', ... }
RecoverPasswordRoute(store), // { path: 'recover-password', ... }
...
]
},
... Hope this helps ;) |
@bulicmatko Thanks ;) . |
@bulicmatko import { injectReducer } from '../../store/reducers'
export default (store) => ({
path: 'login',
getComponent (nextState, cb) {
require.ensure([], (require) => {
const Login = require('./containers/LoginContainer').default
const reducer = require('./modules/login').default
injectReducer(store, { key: 'login', reducer }) // 这个key和components里面拿到的key是同一个key
cb(null, Login)
})
}
}) throw Errors: Invariant Violation: Component(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object. Or how can i connect Login to store? |
success with export const createRoutes = (store) => ([
Login(store)
]) |
@onweer |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I need a landing page 。
Visit the home page(path = '/') and check no session will redirection to /login
Do not want '/login' is in the CoreLayout under the props, but a complete page.
eg:
The text was updated successfully, but these errors were encountered: