Skip to content

Commit

Permalink
Update React.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarkori143 authored Jun 15, 2024
1 parent 92c8a9e commit 5033234
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions Frameworks-or-Libraries/React.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,6 @@ and then in SomeComponent we have access to:

Good idea is to create a custom Route component that will show specific component only when our authentication logic is passed:

```jsx
function PrivateRoute({ component: Component, ...rest }) {
    return (
        <Route {...rest} render={(props) => (_isAuthentictedLogic_) ?
            (<Component {...props} />:
            (<Redirect to={{ pathname: "/noAccess", state: { from: props.location } }} />
            )}
        />
    );
}
```

Then instead of Route use PrivateRoute

Expand Down Expand Up @@ -865,4 +854,4 @@ A: Using command `npx create-react-app {app name}`

**Q: What will be the result of `npm eject`?**

A: Webpack for React application won't be handled automatically anymore. We will have access to Webpack configuration files in order to customize it to our needs.
A: Webpack for React application won't be handled automatically anymore. We will have access to Webpack configuration files in order to customize it to our needs.

0 comments on commit 5033234

Please sign in to comment.