-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using createAction, how would one go about validating the payload passed in? #146
Comments
That is kind of the tradeoff atm, yeah. If you are using You can always still write action creators by hand if you want to. The point of the functions from RSK is to provide an opinionated, obvious, no-boilerplate way of doing things. That said, I'm still considering the idea of a "payload customization" callback somehow - I just haven't had time to think about how that might fit in. |
I'd like to vote for this issue as well. My proposal would be a payload transformer:
In this case (from the original issue comment), the transformer is the identity function with some validation. In other use cases (like the one I have in mind), one could change it into a different value. |
@CGamesPlay : yeah, that's basically the kind of thing I've been picturing. The biggest issue is how to make use of that with |
I'm using this in my project that doesn't use
Is the concern that TypeScript won't automatically know the action type in your
|
Fixed by #149 and out as 0.6.3 . Please let me know if that works for you! |
Let's say I'd like to ensure some required properties are passed into the action creator. How would I do that?
I considered a wrapper function, but then the toString is not on the wrapper and would have to be carried over.
Forgive me if this is more of a StackOverflow type question... but not really seeing any redux-starter-kit talk there.
The text was updated successfully, but these errors were encountered: