content: import React, { Component } from 'react';
  import { Switch, Route, Link } from 'react-router-dom'
  
  import { connect } from 'react-redux';
  import * as actions from '../actions';
  
  class Feature extends Component {
  
    constructor () {
      super()
      this.renderMessage = this.renderMessage.bind(this);
      this.renderHome = this.renderHome.bind(this);
    }
    componentWillMount() {
      this.props.fetchMessage();
    }
  
    renderMessage() {
      if(!this.props.errorMessage) {
        return (
          <div>
            <div>{this.props.message}</div>
            <Link to="/feature">Back to feature home</Link>
          </div>
        );
      }
      else {
        return (
          <div>
            <div>{this.props.errorMessage}</div>
            <Link to="/feature">Back to feature home</Link>
          </div>
        );
      }
    }
  
    renderHome() {
      return(
        <div>
          <div>Feature Home</div>
          <Link to="/feature/message">Go to Protected Message!</Link>
        </div>
  
      );
    }
  
    render() {
      return(
        <Switch>
          <Route exact path='/feature/message' render={this.renderMessage}/>
          <Route path='/feature' render={this.renderHome}/>
        </Switch>
      );
    }
  }
  
  function mapStateToProps(state) {
    return {
      message: state.auth.message,
      errorMessage: state.auth.error
    };
  }
  
  export default connect(mapStateToProps, actions)(Feature);
  