I am Trying to use react-router-dom. When I export my component as
class RandomComponent { // component code}
export default RandomComponent;
and use this as a component in Route as following -
<Route path="/" exact component={RandomComponent} />
I get following warning in chrome console -
Warning: Failed prop type: Invalid prop component
of type object
supplied to Route
, expected function
But When I export my component using
export class RandomComponent{ // component code}
same piece of code starts working, can someone explain me why this is happening? thanks in advance.