All Projects → brianegan → Redux_thunk

brianegan / Redux_thunk

Licence: mit
Redux Middleware for handling functions as actions

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Redux thunk

Redux Subspace
Build decoupled, componentized Redux apps with a single global store
Stars: ✭ 319 (+298.75%)
Mutual labels:  redux-thunk
My Idea Pool Client
💡💡 React + Redux + JWT (Auth) + Formik (Forms). Store and rank your ideas.
Stars: ✭ 18 (-77.5%)
Mutual labels:  redux-thunk
Slopeninja Frontend
Slope Ninja Frontend 🏂❄️⛄️
Stars: ✭ 39 (-51.25%)
Mutual labels:  redux-thunk
Next Shopify Storefront
🛍 A real-world Shopping Cart built with TypeScript, NextJS, React, Redux, Apollo Client, Shopify Storefront GraphQL API, ... and Material UI.
Stars: ✭ 317 (+296.25%)
Mutual labels:  redux-thunk
Simple Trello
📋
Stars: ✭ 431 (+438.75%)
Mutual labels:  redux-thunk
Frontend React
Open sourced front end application for codecorgi.
Stars: ✭ 9 (-88.75%)
Mutual labels:  redux-thunk
react-movies-finder
React Movies finder is a React app to search movies and series using redux, redux-thunk, React Hooks, and Material UI
Stars: ✭ 27 (-66.25%)
Mutual labels:  redux-thunk
Simple Universal React Redux
The simplest possible Async Universal React & Redux Boilerplate app, that works on both Mac and Windows
Stars: ✭ 58 (-27.5%)
Mutual labels:  redux-thunk
Repatch
Dispatch reducers
Stars: ✭ 516 (+545%)
Mutual labels:  redux-thunk
Reactspa
combination of react teconology stack
Stars: ✭ 911 (+1038.75%)
Mutual labels:  redux-thunk
Next.js Typescript Starter Kit
🌳 [email protected], Styled-jsx, TypeScript, Jest, SEO
Stars: ✭ 342 (+327.5%)
Mutual labels:  redux-thunk
React Social Network
Simple React Social Network
Stars: ✭ 409 (+411.25%)
Mutual labels:  redux-thunk
Diagonistician Reactjs Express Mongoose
Question - Answers demo SPA
Stars: ✭ 13 (-83.75%)
Mutual labels:  redux-thunk
Duckduckgo
DuckDuckGo App built in React-Native (Unofficial)
Stars: ✭ 320 (+300%)
Mutual labels:  redux-thunk
React Antd Admin Template
一个基于React+Antd的后台管理模版,在线预览https://nlrx-wjc.github.io/react-antd-admin-template/
Stars: ✭ 1,022 (+1177.5%)
Mutual labels:  redux-thunk
React Proto
🎨 React application prototyping tool for developers and designers 🏗️
Stars: ✭ 3,261 (+3976.25%)
Mutual labels:  redux-thunk
Reactjs Portfolio Mern Website
My Portfolio | Full Stack MERN Application
Stars: ✭ 25 (-68.75%)
Mutual labels:  redux-thunk
Whatsapp Clone React Native
The goal of this project is to build an Whatsapp exactly like the original application, but using React Native & Redux | Firebase
Stars: ✭ 76 (-5%)
Mutual labels:  redux-thunk
React Redux Quotlify
A quote browser and manager that allows one to search famous quotes and save them to a data store
Stars: ✭ 47 (-41.25%)
Mutual labels:  redux-thunk
Create React App Redux
React Router, Redux, Redux Thunk & Create React App boilerplate
Stars: ✭ 885 (+1006.25%)
Mutual labels:  redux-thunk

redux_thunk

Build Status codecov

Redux provides a simple way to update a your application's State in response to synchronous Actions. However, it lacks tools to handle asynchronous code. This is where Thunks come in.

The thunkMiddleware intercepts and calls ThunkActions, which is simply a fancy name for any function that takes 1 argument: a Redux Store. This allows you to dispatch functions (aka ThunkActions) to your Store that can perform asynchronous work, then dispatch actions using the Store after the work is complete.

The dispatched ThunkActions will be swallowed, meaning they will not go through the rest of your middleware to the Store's Reducer.

Example

// First, create a quick reducer
State reducer(String state, action) =>
    action is String ? action : state;

// Next, apply the `thunkMiddleware` to the Store
final store = new Store<String>(
  reducer,
  middleware: [thunkMiddleware],
);

// Create a `ThunkAction`, which is any function that accepts the 
// Store as it's only argument. Our function (aka ThunkAction) will
// simply send an action after 1 second.  This is just an example, 
// but  in real life, you could make a call to an HTTP service or 
// database instead!
void action(Store<String> store) async {
  final searchResults = await new Future.delayed(
    new Duration(seconds: 1),
    () => "Search Results",
  );

  store.dispatch(searchResults);
}

// You can also use a function with some parameters to create a thunk, 
// and then use it like so: store.dispatch(waitAndDispatch(3));
ThunkAction<String> waitAndDispatch(int secondsToWait) {
  return (Store<String> store) async {
    final searchResults = await new Future.delayed(
      new Duration(seconds: secondsToWait),
      () => "Search Results",
    );

    store.dispatch(searchResults);
  };
}


Credits

All the ideas in this lib are shamelessly stolen from the original redux-thunk library and simply adapted to Dart.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].