Questions tagged «react-redux»

Redux的官方React绑定

1
没有重载匹配此调用。过载1,共2
我有store.js档案 import { createStore, combineReducers } from "redux"; import reducerADD from "../reducer/reducerADD" export const store = createStore(combineReducers({ reducerADD})); 当我更改格式时,store.tsx出现错误: No overload matches this call. Overload 1 of 2, '(reducers: ReducersMapObject<{ reducerADD: { lastName: string; firstName: string; password: string; email: string; }[]; }, any>): Reducer<{ reducerADD: { lastName: string; firstName: string; …

3
深入了解useEffect / useEffect的使用?
我试图深入了解这个useEffect钩子。 我想知道何时使用哪种方法,为什么使用? 1.useEffect with no second paraments useEffect(()=>{}) 2.useEffect with second paraments as [] useEffect(()=>{},[]) 3.useEffect with some arguments passed in the second parameter useEffect(()=>{},[arg])

2
React-Redux-Hooks API
我正在尝试配置新的react-redux应用程序以使用React-Redux的新功能。在官方文件说: React Redux现在提供了一组钩子API,以替代现有的connect()高阶组件。 我一直在尝试找到一些与Hooks API相关的帮助文章,并提供一些实际示例,但是所有react-redux Apps都在使用connect函数。官方文档还显示了非常基本的示例。 我想使用useSelector(由Hooks API提供)更改应用程序中的连接功能。 这是我的应用程序中的示例代码片段。 //MessagesListContainer export default connect( // mapStateToProps (state:State) => ({ activeUser: getActiveUser(state), messages: getMessagesList(state), }) )(MessagesList) //Selectors export const getActiveUser = (state: State) => state.activeUser; export const getMessagesList = (state : State) => ( Object.keys(state.messages).map((key : any)=> state.messages[key]) ) export interface IMessagesListProps …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.