We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<Router history={ history }> <Route path="/" getComponents={App}> <IndexRedirect to="projects" /> <Route path="projects" getComponents={Projects}></Route> <Route path="dashboard" getComponents={Dashboard}></Route> </Route> <Route path="*"> </Route> </Router>
import React, {PropTypes, Component} from 'react'; import {connect} from 'dva'; import {Link} from 'dva/router'; import Header from 'components/Common/ProjectManagementNav/ProjectManagementNav' const App = (props) => { console.log("props",props); return ( <div> <Header /> {props.children} </div> ) } function mapStateToProps({ management }) { return { management }; } export default connect(mapStateToProps)(App);
import React from 'react'; import {connect} from 'dva'; import ProjectsContent from 'components/projects/projectsContent'; const Projects = (props) => { console.log(props); return ( <ProjectsContent/> ); }; export default Projects;
The text was updated successfully, but these errors were encountered:
难以阅读,请参考以下文档调整下格式:
Sorry, something went wrong.
整理好了
我的方式是需要用 dispatch 或者引用 model state 的 component 都 connect 一下,当然你也可以把 dispatch 传下去,或者把 dispatch action 封装成一个 function,然后把 function 传下去。
如果都connect一下,就会导致国际化语言切换时,子组件不能正常切换,必须使用window.location.reload()刷新整个页面。但是如果子组件不connect的话,是可以正常切换的。有什么方法可以做到不刷新页面吗
No branches or pull requests
我的场景是这样的
router.jsx我设计成这样的
最外层的path="/" 的 App.jsx 设计成这样的
可以看出我的父组件App有connect过
而下面我的子组件Projects (path="projects")我没有connect
The text was updated successfully, but these errors were encountered: