This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example with classes building components. | |
# This stuff is a little fiddly to get set up, | |
# but once it's working it's great - you can just | |
# add new instances of the components, and each | |
# components holds references to all of its | |
# children. You can set defaults & states for each | |
# component separately. | |
# | |
# (try clicking on the post author, and then on each | |
# of the comments on a post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HookTypes = { | |
type state('a); | |
type effect; | |
type t('t); | |
let addState: (~state: 'state, t('t)) => t(('t, state('state))) = | |
(~state as _, x) => Obj.magic(x); | |
let addEffect: t('t) => t(('t, effect)) = Obj.magic; | |
}; |