Is redux saga better than thunk?

The benefit of Redux-Saga in comparison to Redux-Thunk is that you can more easily test your asynchronous data flow . Redux-Thunk, however, is great for small projects and for developers who just entered into the React ecosystem. The thunks’ logic is all contained inside of the function.

Read more

What are redux saga effects?

Redux Saga is a middleware library used to allow a Redux store to interact with resources outside of itself asynchronously. This includes making HTTP requests to external services, accessing browser storage, and executing I/O operations . These operations are also known as side effects.

Read more

How do I use redux saga in react?

import { useDispatch } from “react-redux”; import { getPosts } from “../store/posts/actions”; Now we can dispatch the action getPosts just after the component is mounted. let dispatch = useDispatch(); useEffect(() => { dispatch(getPosts()); }, []); The complete Home component will be the same as below.8 Eki 2021

Read more