Usually, not needed to make posts and comments related state global (not needed to move it to context), only in case it used in multiple pages. Also, there are no sense to keep isLoggedIn as separate state because it could be calculated from other values, in present example:
I switched from redux to react context few years ago, and I write now less template code. And yes, I miss a good extension for state inspection, like redux chrome extension
Hahaha yeah I thought about the isLoggedIn state as I was writing the post š¤£ I was trying to come up with an abstract idea bc I couldn't just copy paste our code from work š
Without redux devtools Iām crying :ā(
Lol just kidding, I can check context state in react devtools components tree.
I missed to mention: good job and really descriptive article!
Usually, not needed to make posts and comments related state global (not needed to move it to context), only in case it used in multiple pages. Also, there are no sense to keep
isLoggedIn
as separate state because it could be calculated from other values, in present example:<AuthContext.Provider value={{ state: {
user,
isLoggedIn: !!user,
}, setUser }}
I switched from redux to react context few years ago, and I write now less template code. And yes, I miss a good extension for state inspection, like redux chrome extension
Hahaha yeah I thought about the isLoggedIn state as I was writing the post š¤£ I was trying to come up with an abstract idea bc I couldn't just copy paste our code from work š
What do you do without the redux dev tool?
I found this but haven't tried it out yet github.com/troch/reinspect
Without redux devtools Iām crying :ā(
Lol just kidding, I can check context state in react devtools components tree.
I missed to mention: good job and really descriptive article!
Thanks! That's what I've been doing too but I miss the dispatch call stack :(