import React from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; const mapStateToProps = state => ({ value: state.getIn(['search', 'value']), submitted: state.getIn(['search', 'submitted']), }); export default @withRouter @connect(mapStateToProps) class Header extends React.PureComponent { static propTypes = { value: PropTypes.string, submitted: PropTypes.bool, }; state = { submittedValue: '', }; componentWillReceiveProps (nextProps) { if (nextProps.submitted) { const submittedValue = nextProps.value; this.setState({submittedValue}) } } render () { const { submittedValue } = this.state; return (

{submittedValue}

); } }