-
Notifications
You must be signed in to change notification settings - Fork 5
New API modelled after new React context API proposal #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
"react": "^15.2.1", | ||
"react-derivable": "../../", | ||
"react-dom": "^15.2.1" | ||
"react-derivable": "link:../.." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, is it realtime update? Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite as src/
should be built into lib/
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still better then reinstalling
Value: {counter.get()} | ||
<div>Value: {r(counter)}</div> | ||
<div> | ||
Is Even: {renderMap(counter, counter => (counter % 2 === 0 ? 'Yes' : 'No'))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you don't like map
. Maybe renderDerive?:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't create a derivation so I thought it's better not to call it *Derive
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
*/ | ||
|
||
let state = atom({ | ||
let state = Derivable.atom({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found using der
prefix quite nice and small.
der.atom
der.derive
Component = decorateWith(Component, makeReactiveComponent); | ||
return decorateWith(Component, makePureComponent); | ||
export function render<V: React.Node>(d: Derivable.Derivable<V>): React.Node { | ||
return <Reactive d={d} f={renderValue} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somebody would like to use this component directly :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know those guys from new context rfc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some guys from context rfc are jealously prefer jsx over function calls and hocs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it matter? I think we'd like to settle on what React Context API officially settles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style seems to me less noisy than using JSX with function-as-children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't force. Just a note. I'm not a fan of pure jsx too.
This doesn't yet work on server as reactors should not be initialized there. |
Also not sure if we need to add some kind of pure API (a-la
|
Yep, PureComponent won't give wins here. |
c9a0ff1
to
0f08e27
Compare
0f08e27
to
69d9265
Compare
No description provided.