我尝试使用 redux,但我收到了这个错误。
我这样使用:
import React, { Component } from 'react';
import { connect } from 'react-redux';
class LibraryList extends Component {
render() {
return null;
}
}
const mapStateToProps = state => {
console.log(state);
};
export default connect(mapStateToProps)(LibraryList);
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误。我该怎么办。有人可以帮忙吗?
这是我的 app.js
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, FlatList } from 'react-native';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from './src/reducers';
import LibraryList from './src/components/LibraryList';
const App = () => {
return (
<Provider store={createStore(reducers)} >
<View>
<LibraryList />
</View>
</Provider>
);
}
Run Code Online (Sandbox Code Playgroud)
useMemo是一个新的 react 钩子,仅在最新版本的 react 中可用。这个错误是说它对你不可用,所以要解决这个问题,你需要更新 react(如果你正在使用 react-native)。
如果您更新react到16.8.6和react-native到,错误应该消失
0.59.5
有关更多信息,请参阅https://github.com/facebook/react-native/issues/24543
| 归档时间: |
|
| 查看次数: |
2796 次 |
| 最近记录: |