Skip to content
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

DX-friendlier actions creators #2

Open
rainerhahnekamp opened this issue Dec 20, 2023 · 2 comments
Open

DX-friendlier actions creators #2

rainerhahnekamp opened this issue Dec 20, 2023 · 2 comments

Comments

@rainerhahnekamp
Copy link
Collaborator

rainerhahnekamp commented Dec 20, 2023

We initialize already our state with properties like:

withState({flights: [] as Flight[]})

On the other hand, an action requires a payload function (or props in NgRx Global Store):

withRedux({actions: {search: payload<{from: string, to: string>()}})

What if we introduce a second approach with type inference like:

withRedux({actions: {search: {from: '', to; ''}}})

For more complicated cases, payload will still be an option.

@rosostolato
Copy link

A question that might not be related: why do we need the actions to be internal to the store? Why not have external actions created with the createAction function?

This way we can save the actions on a separate file and cleanup the store.

@rainerhahnekamp
Copy link
Collaborator Author

Yeah, that's planned in #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants