Giter Site home page Giter Site logo

Comments (6)

bognix avatar bognix commented on August 14, 2024 1

I would like to propose an alternative

What user provides is this array of states, actions and transitions:

  ['initialize', 'idle',
    ['fetch', 'fetching',
      ['cancel', 'idle'],
      ['report error', 'error',
        ['handle error', 'idle']
      ],
      ['report success', 'success',
        ['handle success', 'idle']
      ]
    ]
  ]
];

and I like how the actionCreators maps state transitions to methods.

If I understand correctly what you are proposing David is to have the same structure in actions so calling actions.handleSuccess would return string value.

How about combining those two and instead of having both actionCreators and actions do something like this:

    handleSuccess: {
        creator: () => {},
        name: "NAME"
    },
    ...
}

On the other hand, I don't like adding another level of nesting and it seems reasonable to just import { handleSuccess, handleError} from './myActionCreators' and then simply call it without accessing nested creator. With this in mind I'm leaning toward David's idea which doesn't include additional nesting but I'm posting above as the food for thought.

from redux-dsm.

ericelliott avatar ericelliott commented on August 14, 2024 1

Merged. Will look at releasing the change with a major version bump soon.

from redux-dsm.

ericelliott avatar ericelliott commented on August 14, 2024

You mean we should expose action type constants as an object with original labels as keys? That's not a bad idea. PR?

from redux-dsm.

dash- avatar dash- commented on August 14, 2024

@ericelliott #20

from redux-dsm.

dash- avatar dash- commented on August 14, 2024

Awesome thanks :-)

from redux-dsm.

ericelliott avatar ericelliott commented on August 14, 2024

Published as 2.0.0

from redux-dsm.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.