what is main difference between redux and redux toolkit, is saga required in redux toolkit? [closed]

Redux used to be great but if you have tried none of them, I would highly recommend using Redux-Toolkit. The only case where I may want you to stick to redux is when you’re using class-based components, where Redux Toolkit does have some boilerplate (like Redux) and you may miss out decent support. However with … Read more

MVVM architectural pattern for a ReactJS application

React itself is not particularly opinionated about software architecture. It is a library that facilitates the reusable component paradigm alongside guidelines for managing things like state and data sharing (props). At some point, Facebook described this as the V in MVC but have since moved away from that marketing to call it more abstractly A … Read more

redux-saga when to use fork?

In general, fork is useful when a saga needs to start a non-blocking task. Non-blocking here means: the caller starts the task and continues executing without waiting for it to complete. There is a variety of situations where this can be useful, but the 2 main ones are: grouping sagas by logical domain keeping a … Read more

What are selectors in redux?

getUser is not a reducer, it is indeed a selector, that is, a function that knows how to extract a specific piece of data from the store. Selectors provide an additional layer such that if you altered your store structure and all of a sudden your users were no longer at state.entities.users but instead at … Read more

Redux Saga async/await pattern

Yes, that’s the standard way to use Redux-Saga. You should never be calling the await function directly inside the saga-generator, because redux-saga is for orchestrating the side-effects. Therefore, any time that you want to run a side-effect you should do it by yielding the side-effect through a redux-saga effect (usually: call or fork). If you … Read more

getState in redux-saga?

you can use select effect import {select, …} from ‘redux-saga/effects’ function* deserialize( action ) { const state = yield select(); …. yield put({ type: ‘DESERIALIZE_COMPLETE’ }); } also you can use it with selectors const getItems = state => state.items; function* deserialize( action ) { const items = yield select(getItems); …. yield put({ type: ‘DESERIALIZE_COMPLETE’ … Read more

Why use Redux-Observable over Redux-Saga?

Disclaimer: I am one of the authors of redux-observable so it’s hard for me to be 100% impartial. We don’t currently provide any reason redux-observable is better than redux-saga because…it’s not. 😆 tl;dr there are pros and cons to both. Many will find one more intuitive than the other, but both are complex to learn … Read more

How to get something from the state / store inside a redux-saga function?

As @markerikson already says, redux-saga exposes a very useful API select() to invoke a selector on the state for getting some part of it available inside the saga. For your example a simple implementation could be: /* * Selector. The query depends by the state shape */ export const getProject = (state) => state.project // … Read more