February 2019
Intermediate to advanced
204 pages
4h 52m
English
Now, we need to connect the React component with Redux. For this, we use the function connect from: react-redux. We've already used these functions in Chapter 1, Understanding Redux. Let's modify our container, as shown in the following code:
import React, { Component } from 'react';import { connect } from 'react-redux';import { compose } from 'redux';import Form from './Form';import { onRegisterRequest } from './actions';class RegisterPage extends Component { render() { return ( <div className="register-containers"> <Form onSubmit={this.props.onSubmit} /> </div> ); }}export const mapDispatchToProps = dispatch => ({ onSubmit: e => dispatch(onRegisterRequest(e.toJS())),});const withConnect = connect( null, mapDispatchToProps, ...Read now
Unlock full access