Skip to content

Commit

Permalink
day 18 has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
Asabeneh committed Oct 18, 2020
1 parent 6821f7c commit 29798cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 17_React_Router/17_react_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [NavLink](#navlink)
- [Nested Routing](#nested-routing)
- [Redirect](#redirect)
- [Prompt](#prompt)
- [Exercises](#exercises)
- [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2)
Expand Down Expand Up @@ -1102,6 +1103,8 @@ const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
```

## Prompt

Sometimes when a user try to leave a page we may like to inform that he has unfinished task. In order to do that we can use the Prompt component. The Prompt component takes two props which are when and message(<Prompt when = {true ? 'Happy':'Sad'} message = 'When even I am happy' />). Let's implement this in the previous code.

In the following code a Prompt has been implemented without when therefore it will check all the routes.
Expand Down Expand Up @@ -1404,7 +1407,7 @@ const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
```

Instead of without condition, let's inform the user if he really wants to log out.
Instead of without condition, let's inform the user if he really wants to log out by adding checking some condition using a call back function inside the message.

```js
import React, { Component } from 'react'
Expand Down

0 comments on commit 29798cb

Please sign in to comment.