框架是react, 脚手架为dva官方脚手架
下面是模块共享数据文件 ==>modle/todos.js
const R = require('ramda') //<=====
// import R from 'ramda' //<=====
export default {
namespace: 'todos',
state: {
'list': [
{
'title': '吃饭',
'done': true
},
{
'title': '睡觉',
'done': false
},
{
'title': '拉屎',
'done': false
}
],
'visible': 0,
},
effects: {
},
reducers: {
change_todo(state, action) {
return R.set(R.lensProp('visible'), action.visible, state)
},
},
};为什么将引包方式换成
import R from 'ramda'
后会报错,
报错内容为
TypeError: Cannot read property 'set' of undefined
相关分类