Skip to content

Comments

BCN 04/19 - Yvonne Moser#29

Open
mucklaa wants to merge 3 commits intoironhackbcn:masterfrom
mucklaa:master
Open

BCN 04/19 - Yvonne Moser#29
mucklaa wants to merge 3 commits intoironhackbcn:masterfrom
mucklaa:master

Conversation

@mucklaa
Copy link

@mucklaa mucklaa commented May 15, 2019

Don't know why and where to use Switch? :)

@mucklaa mucklaa changed the title done BCN 04/19 - Yvonne Moser May 15, 2019
}

export default App;
//Switch??

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch is basically the react-router equivalent to a JavaScript switch statement.

Within the Switch component, Route and Redirect components are nested inside. Starting from the top Route/Redirect component in the Switch, to bottom Route/Redirect, each component is evaluated to be true or false based on whether or not the current URL in the browser matches the path/from prop on the Route/Redirect component.

if you do it without it wont have this true/false ability so you can render more than one route at a time and have to use the exact keyword to get around it :)

import countries from '../data/countries.json';


const getCountryByCca3 = (cca3) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good seperation of concerns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants