reading-notes


Project maintained by mr-atta Hosted on GitHub Pages — Theme by mattgraham

Redux - Additional Topics



What’s the best practice for “pre-loading” data into the store (on application start) in a Redux application❓ 📁

The most ‘redux-like’ way of handling the pre-loading of data would be to fire off the asynchronous action in the lifecycle method of a Higher Order Component that wraps your app.

When using a thunk/async action that dispatches the actual action, which do you export from your reducer❓ 📁

The state



thunk

Redux Thunk is a middleware that allows you to call the action creators that return a function(thunk) which takes the store’s dispatch method as the argument and which is afterwards used to dispatch the synchronous action after the API or side effects has been finished.


Redux

Redux

Redux Toolkit (RTK)

The Redux Toolkit package is intended to be the standard way to write Redux logic.

It includes several utility functions that simplify the most common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire “slices” of state at once without writing any action creators or action types by hand. It also includes the most widely used Redux addons, like Redux Thunk for async logic and Reselect for writing selector functions, so that you can use them right away.

The official, opinionated, batteries-included toolset for efficient Redux development.

Why Use Redux Toolkit ❓

makes it easier to write good Redux applications and speeds up development

Redux Toolkit included :

Tutorials Overview

The Redux core docs site at https://redux.js.org contains the primary tutorials for learning Redux, including how to use Redux Toolkit and React-Redux together.


📌 Redux Toolkit (RTK)

📌 Tutorial

📌 MobX

📌 HookState