How to implement constraints for reducers, etc.
See original GitHub issueMaybe it’s just my newness to the Elm Architecture, but I’m having a hard time figuring out how to do constraints with reducers, etc. For example, in the GoMix todo example when you click the button, it adds a todo whether the input has a value or not. For keyup I can put a constraint like this:
// If the input has value and the user hits Enter, add todo.
onkeyup={e => (e.keyCode === 13 && e.target.value) ? actions.add() : ""}
But for the button click that won’t work because it doesn’t have access to the input value. Old school way would be on button click check value of input, if it has a value, do stuff, otherwise not. How do you do that with this pattern? This would also come up with form validation. 🤔
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Redux Fundamentals, Part 3: State, Actions, and Reducers
The official Redux Fundamentals tutorial: learn how reducers update state in response to actions.
Read more >Understanding Redux: A tutorial with examples
In this tutorial, we'll show you what Redux is, why you should use it, and how it works. We'll demo using a simple...
Read more >Reducer Composition with Effects in JavaScript #1528 - GitHub
We'd be able to use vanilla combineReducers() , or really, ... So basically, with the set of constraints imposed by the way Redux...
Read more >Optimization of Two-Stage Cylindrical Gear Reducer with ...
revising the corresponding boundary constraints dynamically during the optimization process are researched and implemented. Finally, dedicated interactive.
Read more >[PDF] Reliability-based design optimization for RV reducer ...
stable transmission and high positioning accuracy, and etc. ... implement RBDO for the RV reducer, an RBDO optimi-. zation model for the RV ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, I was thinking an effect was the way to go, but I wan’t sure. Thanx. 🍺🍻
@dodekeract 👍
@rbiggs it sounds to me like an effect too. Make an effect, then just pass
e
to it, and do you checking and all that stuff there, not in the view part.