import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; const mapStateToProps = state => ({ value: state.getIn(['search', 'value']), submitted: state.getIn(['search', 'submitted']), }); class Header extends ImmutablePureComponent { 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; if (!submittedValue) { return null; } return (