[1] https://github.com/gcanti/fp-ts [2] https://www.cl.cam.ac.uk/~jdy22/papers/lightweight-higher-ki...
111 karma · joined August 4, 2014
[1] https://github.com/gcanti/fp-ts [2] https://www.cl.cam.ac.uk/~jdy22/papers/lightweight-higher-ki...
[1] https://github.com/gcanti/tcomb [2] https://github.com/gcanti/babel-plugin-tcomb
Me too, thus I wrote https://github.com/gcanti/tcomb
- works with regular objects and arrays - runtime type checks - easy debugging with Chrome DevTools - immutability and immutability helpers - runtime type introspection - easy JSON serialization / deseralization - pattern matching
Also https://github.com/gcanti/redux-tcomb (Immutable and type-checked state and actions for Redux)
I wrote a library specifically with this goal: https://github.com/gcanti/tcomb-form. React.js + Bootstrap + ARIA support. Maybe it could be integrated with react-ui-builder
You can define middlewares, as you would do server-side with expressjs:
router.route({
method: 'GET',
path: '/users/:userId',
handler: function (ctx) {
// load user async
getUser(ctx.params.userId, function (err, user) {
ctx.user = user;
ctx.next(); // exec next middleware
});
}
});
There is a `demo` folder with a detailed example. The main entry point for the client is here https://github.com/gcanti/tom/blob/master/demo/client.js#L21Here's my lab https://github.com/gcanti/tom
1. receive an "intent" (request) 2. get whatever data that intent depends on 3. choose a suitable view
I tend of think UIs as projections of the state/model
My main use case at the moment is generating tons of forms for our internal backoffice(s) (for whom the Bootstrap theme is good enough), but with the new customization feature I'm going to use this library for our customer web app as well.
I'd love to hear your feedback.
type Node = {
tag: string,
attrs: object<name, value>,
children: undefined | null | Node | Array<Node>
}
If your component handle a private state, you can inject a state to test different configurations.This is an example of massive use in a form generation library:
https://github.com/gcanti/tcomb-form/blob/master/test/test.j...
Hope it can help you too.
Well, it's quite easy to write something like Facebook Immutability Helpers [1]. As you correctly stated, it really depends on your own use case and performance issues.
I'll try some perf experiment with [1] or something similar to see what comes out.
Pros:
- you can use native data structures instead of continually wrap / unwrap
- you can use native methods on them (map, filter, ...)
- hence (almost) no interoperability problems with other libraries
- overall your coding style doesn't change so much
- (possible perf gains since the js engine knows the object is frozen? - I really don't know)
- EDIT: 0KB dependency
Cons:
- you must find / write a way to update efficiently
I think this will be the most revolutionary aspect in the next months, both for development and tests. I wrote an article explaining why I have this opinion:
https://gcanti.github.io/2014/10/29/understanding-react-and-...
Discovery is a problem for users and also for authors. I wrote a form library https://github.com/gcanti/tcomb-form but I really don't know how to promote it other than add the `react-component` keyword (for [1] ) and list it on [2].
[1] http://react-components.com/
[2] https://github.com/facebook/react/wiki/Complementary-Tools
Shameless plug: I wrote a similar library based on set theory (I'm a mathematician)
https://github.com/gcanti/tcomb
EDIT: and here an article explaining the rationale behind the library
https://gcanti.github.io/2014/09/29/javascript-types-and-set...