在加入provider 等之后运行react app显示空白页面
来源:6-10 如何使用 React-redux(1)
慕前端6301706
2019-06-11
index.js 代码 import React from 'react'; import ReactDOM from 'react-dom'; import TodoList from './TodoList'; import { Provider } from 'react-redux'; import store from './store'; const App =( <Provider store={store}> <TodoList /> </Provider> ) ReactDOM.render(<App />, document.getElementById('root')); TodoList 代码 import React,{ Component } from 'react'; import store from './store'; import { connect } from 'react-redux'; class TodoList extends Component { render(){ return( <div> <div> <input value={this.props.inputValue} /> <button>submit</button> </div> <ul> <li>DELL</li> </ul> </div> ) } } const mapStateToProps = (state) =>{ return { // 映射 inputValue:state.inputValue } } export default connect(null,null)(TodoList); 不知道是哪里出了问题 好像代码和老师是一样的
写回答
2回答
-
旺旺加油
2020-02-17
应该是ReactDOM.render(App, document.getElementById('root'));
App是个变量,里面已经有完整的组件了
20 -
Dell
2019-06-11
控制台看一下报错么
00
相似问题