August 2017
Beginner
374 pages
10h 41m
English
Next, we need to create the component that will display the error object:
import React from 'react'const ErrorMessage = ({ message }) => message ? <span style={{ color: 'red' }}>Error: {message}</span> : nullexport default ErrorMessage
import { connect } from 'react-redux'import ErrorMessage from '../components/ErrorMessage.jsx'const mapStateToProps = (state, props) => { return { message: state.error && state.error.message }}const ConnectedErrorMessage = connect(mapStateToProps)(ErrorMessage) ...Read now
Unlock full access