4 ms·
I think this looks pretty cool; I like how simple and general the last validation function is. If you're generating the UI from the model all the better (it lo
by couchand 12y ago
I think this looks pretty cool; I like how simple and general the last validation function is. If you're generating the UI from the model all the better (it looks like there's a note on this front at the bottom of the tcomb.js readme). This would be remarkably easy to do with React, and it all could be abstracted into a simple configuration framework.
Looks like there's a typo in the last example: you probably want to use the Struct param in the fetch function rather than explicitly creating a User.
Seems like the makings of something like Bootstrap for domain models here. Neat.
- gcanti 12y ago> Looks like there's a typo Good catch! thank you, I'll fix that asap. As you've pointed out, I am excited by the opportunity to implement this cycle Domain (tcomb.js) --> UI generation (React.js, with validated props) ^ | | | | | +-------------------------- Input validation Some example off the top of my head | T | input | +----------+------------------------+ | Str, Num | textbox, textarea | | enums | select, radio | | struct | form | | list(T) | table of T (recursion) |
- insin 12y agoTo address the "explore using tcomb with React.js" point in tcomb's README, you'll find that it's a perfect fit, so go for it! Already having immutable instances all-but guarantees an easy performance boost down the line, and React's rendering takes so much fluff out of displaying and redisplaying forms in any state. Just have a component give you a callback to let it know when state has been updated and it should be easy enough to integrate. I switched my port of django.forms away from using my own DOM library to generating React components: https://github.com/insin/newforms https://github.com/insin/newforms
- couchand 12y agoI've seen your newforms library before and been interested but I got frustrated trying to read through the examples. The leading commas are so distracting! Sorry to harp on a minor point.