MERN Stack Part 5 : Using the React Context API and creating an AuthService

preview_player
Показать описание
In this tutorial, we're going to be using the React Context API to provide a global state throughout our React application. We're also going to be creating an AuthService in order to make calls to our backend.
Рекомендации по теме
Комментарии
Автор

I decided to learn React by recreating a blog app I created in Angular, and this series makes way more sense than any other MERN vids I've seen

nevrcore
Автор

Easily the best one I have seen. Although, I am using session-based auth and u are using token-based auth, still very relevant and I sincerely want to thank you for posting this!

백-kj
Автор

the best playlist about Auth i had ever seen Big Thannnnks

rishabhgarg
Автор

oh man I didn't know that proxy thing and I had to go back and forth by changing my 6 different fetch codes with localhost and my domain too many times lol. I knew there had to be something more sensible...

tayfun
Автор

I am lost but your video is opening my mind thanks so much

munandisichali
Автор

The code is not working for me, probably because of the react-script v 5.0.0, it was showing error Module not found. Field 'browser' doesn't contain a valid alias configuration and Polyfill node core modules in webpack 5. I edited the node_modules, webpack added fallback installed required packages it still aint running for me

rishabjain
Автор

Is there a repo link available? It'd be super helpful to have access to the code.

kaylafolwick
Автор

If anybody can help it would be greatly appreciated. After following the tutorials, my app is stuck on 'loading'. When I try to fetch the data and set the user/auth and isLoaded it doesn't return the data? So none of the options are set, and loading is all that shows. Does anybody have any ideas? My backend is returning the /authenticated endpoint when a user is logged in. I'm new to this so I might be missing something obvious, but I'm having trouble moving on until I can figure this out.

shaughnessychris
Автор

is there a way to do this without setting the proxy in package.json?

kishoret
Автор

Can anybody help with this issue ??
VM750:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
It shows when useffect is start his work

vanovasilyan
Автор

1] ./src/Context/AuthContext.js
[1] Line 22:11: 'isloaded' is not defined no-undef
[1] Line 23:40: 'user' is not defined no-undef
[1] Line 23:45: 'setUser' is not defined no-undef
[1] Line 23:53: 'isAuthenticated' is not defined no-undef
[1] Line 23:69: 'setIsAuthenticated' is not defined no-undef
[1] Line 24:14: 'children' is not defined no-undef

gobinathshanthakumar
Автор

What is the use of AuthProvider in index.js file

yogsharma
Автор

can anyone explain how to push this project to github ? because when i try to get my full app on GitHub I will get a git repo inside a git repo !

salim
Автор

Anyone running into proxy error from 3000 to 5000, add "secure" : false too your proxy settings in the package.json file (client)

PBUK
Автор

I am getting this error

src\App.js
Line 6:64: 'useContext' is not defined no-undef
Please help me

praptimaheshwari
Автор

useEffect(()=>{

.then(data =>{
setUser(data.user);

setIsLoaded(true);
})
Error : Cannot read property 'user' of undefined
how to fix it ?
Awesome tutorial series btw ♥ ♥

hamzabenali
Автор

Not working as expected. Getting errors.

satyainr
Автор

Hi pedro, can you share your code. i am getting some errors i cant figure out why. The error is coming from AuthContext file.

shollybenjamin
Автор

For anyone getting a "Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0" after setting up the AuthContext / AuthProvider, you may just need to kill your servers and then restart for the proxy to take effect.

makspazuniak
Автор

WTF 30 minutes videos without any saving and to test how look in browser code ??? Todo MERN is for beginers not for intermediated or advanced programmers, so how can beginerr remember what is doing and for what need 30 minutes of code??? For each component need to make save and to test to browser, so begginer can understand for what need this piece of code and for what other

suadayzo
join shbcf.ru