react-redux

page is not rendering when I click back button with react-router

梦想的初衷 提交于 2020-08-27 21:33:06
问题 I have an application that has this top level component: import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter as Router } from 'react-router-dom'; import { Provider } from 'react-redux'; import { createStore } from '../lib/Store.js'; import Application from '../components/application'; document.addEventListener('DOMContentLoaded', () => { ReactDOM.render( <Provider store={createStore()}> <Router> <Application /> </Router> </Provider>, document.body.appendChild

How to get state updated after dispatch

妖精的绣舞 提交于 2020-08-27 15:26:23
问题 I'm new with react-native and redux and I want to know how can I get the state updated after the dispatch... Follow my code: /LoginForm.js function mapStateToProps(state) { return { user: state.userReducer }; } function mapDispatchToProps(dispatch) { return { login: (username, password) => { dispatch(login(username, password)); // update state loggedIn } } } const LoginForm = connect(mapStateToProps, mapDispatchToProps)(Login); export default LoginForm; /Login.js ---Here I've a button which

Named exports with redux?

我怕爱的太早我们不能终老 提交于 2020-08-24 09:50:06
问题 i have got used to using named exports as it makes life easier for refactoring. I have just started to implement redux but it seems i can't do a named export because the connect needs to map the component. so for example class Something extends Component { ... } export default connect(mapStateToProps)(Something); Would it be possible to use a named export like "Something", i can't place the export on the class as although react continues to work - the connect is not getting exported so there