diff --git a/JavaScript/React/React Router.md b/JavaScript/React/React Router.md index 2895428..0ae60a2 100644 --- a/JavaScript/React/React Router.md +++ b/JavaScript/React/React Router.md @@ -46,24 +46,10 @@ import { Route, Switch } from "react-router-dom"; - {/* mathes all non-existent URLs */} + {/* matches all non-existent URLs */} ``` -### Redirectin - -```js -import { Redirect } from "react-router-dom"; - -// redirects to another URL, should'nt be rendered on component mount but after an action - - -{ condition && } // redirect if condition is true - -// or redirect manipolating the history (alwais in props) -props.history.push("/new-route"); -``` - ### URL Parameters & Query String ```js @@ -78,12 +64,26 @@ function Component(props) { } ``` -### Propts +### Redirecting + +```js +import { Redirect } from "react-router-dom"; + +// redirects to another URL, should'nt be rendered on component mount but after an action + + +{ condition && } // redirect if condition is true + +// or redirect manipolating the history (always in props) +props.history.push("/new-route"); +``` + +### Prompts ```js import { Prompt } from "react-router-dom"; -// displayes a prompt when the conditioni true +// displayes a prompt when the condition is true ```