React Router: Router, Route, and Link

Joe Maddalone
InstructorJoe Maddalone

Share this video with your friends

Send Tweet

In this lesson we'll take our first look at the most common components available to us in react-router; Router, Route, and Link.

Itai
Itai
~ 5 years ago

Joe, why didn't you have to use parenthesis around the Links function?

Joe Maddalone
Joe Maddaloneinstructor
~ 5 years ago

"return" is not required in ES6 arrow functions, but rather inferred after the fat arrow. If I had been using an implicit return statement I would have used parens.

const Links = () => "Links" // returns "Links"
const Links = () => {
    return "Links" // implicit return returns "Links"
}
const Links = () => {
    return (
         "Links" // implicit return returns "Links"
    )
}
prabhuignoto
prabhuignoto
~ 4 years ago

i am having trouble running the examples with react router v4

Bogdan Martinescu
Bogdan Martinescu
~ 4 years ago

Outdated with React Router v4... Joe should update this course maybe

Byron Lopez
Byron Lopez
~ 4 years ago

That would be a good idea, I'm struggling with this issue "warning.js:36 Warning: Failed prop type: The prop history is marked as required in Router, but its value is undefined." and also library versions are very old!!

Nick
Nick
~ 4 years ago

well this does not work anymore