How can I display a modal dialog in Redux that performs asynchronous actions?

I’m building an app that needs to show a confirm dialog in some situations. Let’s say I want to remove something, then I’ll dispatch an action like deleteSomething(id) so some reducer will catch that event and will fill the dialog reducer in order to show it. My doubt comes when this dialog submits. How can … Read more

TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app

I’m working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get this error: TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined I have no idea why this is happening, if anyone has experienced this I would be grateful. … Read more

React Context vs React Redux, when should I use each one? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago. Improve this question React 16.3.0 was released and the Context API is not an experimental feature anymore. Dan Abramov … Read more

When to use ES6 class based React components vs. functional ES6 React components?

After spending some time learning React I understand the difference between the two main paradigms of creating components. My question is when should I use which one and why? What are the benefits/tradeoffs of one over the other? ES6 classes: import React, { Component } from ‘react’; export class MyComponent extends Component { render() { … Read more

Accessing Redux state in an action creator?

Say I have the following: export const SOME_ACTION = ‘SOME_ACTION’; export function someAction() { return { type: SOME_ACTION, } } And in that action creator, I want to access the global store state (all reducers). Is it better to do this: import store from ‘../store’; export const SOME_ACTION = ‘SOME_ACTION’; export function someAction() { return … Read more

What is mapDispatchToProps?

I was reading the documentation for the Redux library and it has this example: In addition to reading the state, container components can dispatch actions. In a similar fashion, you can define a function called mapDispatchToProps() that receives the dispatch() method and returns callback props that you want to inject into the presentational component. This … Read more

Pros/cons of using redux-saga with ES6 generators vs redux-thunk with ES2017 async/await

There is a lot of talk about the latest kid in redux town right now, redux-saga/redux-saga. It uses generator functions for listening to/dispatching actions. Before I wrap my head around it, I would like to know the pros/cons of using redux-saga instead of the approach below where I’m using redux-thunk with async/await. A component might … Read more