using curried function is a good idea! it's very useful for handling multiple similar state changes.
another approach, if you're dealing with form elements like inputs etc. would be to use name attribute, something like this:
but of course it works only with certain html elements (<input>, <select>, <textarea> among them) and IIRC specification says name should be lowercase, although I don't think I've run into any problems with camelCase name so far.
using curried function is a good idea! it's very useful for handling multiple similar state changes.
another approach, if you're dealing with form elements like inputs etc. would be to use
nameattribute, something like this:but of course it works only with certain html elements (
<input>,<select>,<textarea>among them) and IIRC specification saysnameshould be lowercase, although I don't think I've run into any problems with camelCasenameso far.I like this, how about leveraging a
data-attribute instead ofname?