import ImmutablePropTypes from 'react-immutable-proptypes'; 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']), }); export default @connect(mapStateToProps) 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 (

{submittedValue}

); } }