An open API service indexing awesome lists of open source software.

https://github.com/mbrsagor/youreacker

The project is React.JS basic to Advance topic. when sometimes forgot anything then I follow the repo. The repo is very helpful for every start-up react.JS developer.
https://github.com/mbrsagor/youreacker

context-api-react hooks-api-react reactjs redux

Last synced: 4 months ago
JSON representation

The project is React.JS basic to Advance topic. when sometimes forgot anything then I follow the repo. The repo is very helpful for every start-up react.JS developer.

Awesome Lists containing this project

README

        

# YouReacker
> The repo is pure React.JS project where has basic to advance topic in react.js step by step.

#### Install and run the repo in your local dev server.

The following steps will walk you thru installation on a Mac. I think linux should be similar. It's also possible to develop on a Windows machine, but I have not documented the steps. If you've developed the `React` apps on Windows, you should have little problem getting up and running.

```base
git clone https://github.com/mbrsagor/youReacker.git
cd youReacker
yarn install
yarn start
```
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

###### Context API

```javascript
import React, { Component, createContext } from 'react'

const Profile = () => {
return (

{value => (


Name: {value.user.name}


Email: {value.user.email}



)}

)
}

const Navbar = () => {

return (

{({isAuthenticated, toggleAuth}) => (
<>
{isAuthenticated ? Logout : Login}
>
)}

)
}

const User = () => {
return (

{value => (





{value.isAuthenticated ? :

Please login.

}

)}

)
}

const AuthContext = createContext();

/**
* Main conponent
*/

class ContextAPI extends Component {

state = {
user: {
name: 'Mbr sagor',
email: '[email protected]',
profession: 'software engineer'
},
isAuthenticated: true
}

toggleAuthenticated = () => {
this.setState(prev => ({isAuthenticated: !prev.isAuthenticated}));
}

render() {
return (



Context API





)
}
}

export default ContextAPI
```