JavaScript Invalid prop `component` of type `object` supplied to `Route`, expected `function` invalid prop component of type object supplied to route,invalid

I've been struggling with this for awhile and can't seem to find anyone else with the same issue. I've got this component and container which are my start screen which should be rendered at the initial route.

components/DifficultySelection.jsx

import React from 'react';
import PropTypes from 'prop-types';

export default class DifficultySelection extends React.Component{

  constructor(props){
    super(props);
    this.onClick = this.onClick.bind(this);
  }

  onClick(e){
    this.props.onDifficultyClick(e.target.innerHTML);

    this.props.history.push("/play");
  }

  render(){
    return (
      <div>
        <h2>Select your difficulty</h2>
        <div>
          <h3 onClick={this.onClick}>Easy</h3>
          <h3 onClick={this.onClick}>Medium</h3>
          <h3 onClick={this.onClick}>Hard</h3>
        </div>
      </div>
    )
  }
}

DifficultySelection.propTypes = {
  onDifficultyClick: PropTypes.func.isRequired
}

containers/DifficultySelection.jsx

import DifficultySelection from '../components/DifficultySelection';
import { setBoardSize } from '../actions/actions';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
  onDifficultyClick: (difficulty) => {
      console.log(difficulty);
      let boardSize = 8;
      if(difficulty === "Medium")  boardSize = 12;
      if(difficulty === "Hard") boardSize = 15;
      if(difficulty === "Extreme") boardSize = 20;

      dispatch(setBoardSize(boardSize));
    }
  }
}

export default withRouter(connect(
  null,
  mapDispatchToProps
))(DifficultySelection)

Below is where I try and assign these components to a route. This is where I am getting the error. As an aside, the console logs I put in show that the components I'm importing are Route functions, the image of which is included because it should be a class I think.

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
import reducers from './reducers/reducers';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { HashRouter, Route, Switch } from 'react-router-dom';

import DifficultySelection from './containers/DifficultySelection';
import Board from './containers/Board';

let store = createStore(combineReducers(reducers));

console.log(DifficultySelection.type);
console.log(Board.type);

ReactDOM.render(
  <Provider store={store}>
    <HashRouter>
      <Switch>
        <Route exact path="/" component={DifficultySelection}/>
        <Route exact path="/play" component={Board}/>
      </Switch>
    </HashRouter>
  </Provider>,
  document.getElementById('root'));
registerServiceWorker();

enter image description here

Answer:1

Why would one need to use .constant(value) from lodash/fp/constant? I saw some other guys use _.constant(true) or _.constant(1) but don't really know what is the benefit of it. From what I know ....

Why would one need to use .constant(value) from lodash/fp/constant? I saw some other guys use _.constant(true) or _.constant(1) but don't really know what is the benefit of it. From what I know ....

I know that there are a lot of posts about that in web, but none of them satisfied me. Most of people recommends appending a verizon number to each script/css file. But this sound like a lot of job to ...

I know that there are a lot of posts about that in web, but none of them satisfied me. Most of people recommends appending a verizon number to each script/css file. But this sound like a lot of job to ...

Consider the following code: if(boolean) return; What is the purpose if this condition? Is it logically the same as: if(boolean) { return true; } Thank you for answering!

Consider the following code: if(boolean) return; What is the purpose if this condition? Is it logically the same as: if(boolean) { return true; } Thank you for answering!

  1. function boolean return
  2. function boolean return vb.net

I have a div component to clone that contains primefaces components and that goes like this : <div id="languageBox1"> <p> <h:form> <label>Language</...

I have a div component to clone that contains primefaces components and that goes like this : <div id="languageBox1"> <p> <h:form> <label>Language</...

  1. primefaces clone component