React Redux with Hooks

preview_player
Показать описание
react-redux new version now supports full usage of hooks with new function APIs.

⌨️ Full code using Connect

⌨️ Full code using hooks

❤️ Become a Patron and help the channel grow

👨‍👨‍👦 Join the community

🌍 Channel's website
Рекомендации по теме
Комментарии
Автор

Important: I've updated the code in the 'redux-hooks' branch to use 'useDispatch' instead of 'useActions' since that has been removed in version 7.1.0-alpha.4 (link to the repository is in the description).

so instead of this:

const addTodo = useActions(addTodoAction);

we write this:

const dispatch = useDispatch();
const addTodo = (todo) => dispatch(addTodoAction(todo))

Classsed
Автор

Nice overview for using hooks with react redux! By the way, the unknown components in react dev tools is because you were exporting your components as an anonymous function.

wataruikedakay
Автор

useActions() removed in v7.1.0-alpha.4, based on Dan Abramov's suggestion.

MeloGrigorian
Автор

This has been super helpful for a project I've been working on. Thanks so much!

NirBenita
Автор

Thank you, Clearly explained the class -> hook migration process.

abhilashgandreti
Автор

Very good video man.

I've just started a new project and I'm getting into hooks, so your video was really useful, thank you so much for sharing.

danilo
Автор

Hii sir, i have a query.. if suppose i want to fetch data from my backend, so where should i used my fetch request.. in class based component we fetch request in componentDidMount() method, so in functional based component where should i used?

ashishnirvikar
Автор

Jump to 18:44 for explanation on using Redux hooks (everything before this is setting up the code)

chrisperry
Автор

anyone explain to me why using bind at 28.15 at TodoList.js

sunstrike
Автор

do i need to use reselect if using useSelector(), will it replace reselect ?

creative-commons-videos
Автор

That was incredibly fluent and helpful. Thanks!

parsaenami
Автор

using useDispatch would be much better than useActions

Virus-kexj
Автор

i guess must to update this video :

1- instead of const addTodo = useActions(addTodoAction) remplace to const dispatch = useDispatch(); const addTodo = (todo) => dispatch(addTodoAction(todo))
2- Instead of window.devToolsExtension && window.devToolsExtension() remplace to &&

kamalkamals
Автор

Very clear easy to understand and useful tutorial about redux I ever watch, Thank you, brother...
My advice: I think to define the reducer function before using it, which make it easier to understand the entire thing

nelsonfrank
Автор

I am not getting the state, I am get this error all the time "TypeError: Cannot read property 'setOpen' of undefined" I have your code. when I log in as a user I am able to get user state when I am logged out I cannot get state my UI state or modal state.. But I do not need to be logged in on the pages that I need the state. What could I be doing wrong?

baremetals
Автор

why not use useReducer in hooks instead of redux. any reasons please

geelemo
Автор

Love your tutorial. However, i still do not really understand why facebook removed useActions hooks and replacing it with useDispatch. As you showed in the video, for the connect version, we just simply import the action creator, for example, addTodoAction and directly use it with addTodoAction(newTodo), we no longer need to dispatch it manually.But when back to useDispatch, we still have to dispatch an action by using dispatch(addTodoAction(newTodo)), wrapping and wrapping again. Personally my preference is to keep both useActions and useDispatch, like what connect does. you can pass actionCreator, or pass nothing, or pass mapDispatchToProps to the connect, but now in hooks, we could only use dispatch to trigger an action, feels really sad with that.

yinweiting
Автор

How to add a remote API capability if TODO store is remote and all list, update and add operations should be executed over REST API?

krishind
Автор

Hi. Could you please extend this by implementing localStorage to save the todos, and then fetching the todos with a getTodosAction?

shellcasing
Автор

Thanks. I'm always interested in hooks and efficient use of state - minimizing re-renders.

eleah