Raq*_*oss 8 javascript reactjs redux
通过学习Redux如何工作,我非常绊脚石.我目前收到以下错误:
Warning: Failed propType: Invalid prop `children` of type `object` supplied to `Provider`, expected `function`
Uncaught TypeError: children is not a function
Run Code Online (Sandbox Code Playgroud)
我的代码如下 - 是否有人能够发现我为什么会收到此错误?
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers } from 'redux';
import { Provider, connect } from 'react-redux';
import * as reducers from '../reducers/index';
import SassMeter from '../components/SassMeter';
import * as SassActions from '../actions/SassActions';
import _ from 'lodash'
const reducer = combineReducers(reducers);
const store = createStore(reducer);
ReactDOM.render(
<Provider store={store}>
<SassMeter />
</Provider>,
document.getElementById('root')
)
Run Code Online (Sandbox Code Playgroud)
根据我的理解,它抱怨我向提供者传递了一个无效的道具,但我看到的所有例子都遵循我所遵循的模式 - 使用创建商店createStore(),然后将其作为道具传递给提供者,它包装你的根元素.我觉得也许我错过了一些事情,connect但我不确定是什么.
所有帮助非常感谢!
| 归档时间: |
|
| 查看次数: |
3869 次 |
| 最近记录: |