-
Notifications
You must be signed in to change notification settings - Fork 27
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
document how to migrate from react #41
base: master
Are you sure you want to change the base?
Conversation
Well done! A React user could get up and going in 5 minutes from that. As a React user, I have a few follow-ups that still aren't clear. Components have been a bit of a blocker so far for me, although I've been struggling a bit with nanocomponent. Although this sounds like it's still a WIP so maybe that needs to be sorted out. The next is that I don't understand the difference in the diffing model that React and choo use. This has led to many bugs and confusing moments for me. Finally forms, are mysterious to me. React has the concept of controlled components for forms, and I haven't seen a mapping of this concept. I've also had choo obliterate the contents of my forms while diffing. |
@gregtatum sick! - will do! |
|
||
## Declarative Rendering | ||
Both React and Choo have a system that allows you to define of "this is what the | ||
DOM should look like". React uses JSX, and Choo uses Template String Literals. |
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.
React uses JSX
This is a huge difference, and the main reason why I've never wanted to try React. Should we talk a bit more about the non-standard jsx? I mean how it forces you to use some specific environment config. Choo on the other side expect native DOM, we could even replace choo/html
and use any other DOM library. IMO, this difference is huge.
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.
Yes, although I don't think this guide should serve as a list of things that Choo has over React :P
#### Choo | ||
```js | ||
var tree = html` | ||
<button onclick={onclick}> |
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.
should be onclick=${onclick}
since this are template strings literals
|
||
However, there are a good amount of differences. At its core Choo is | ||
"declarative rendering" + "shared event emitter" + "router". Once you understand | ||
how these pieces fit together, you'll quickly be able to create an intuition for |
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.
"create an intuition for" -> "understand"
|
||
## Declarative Rendering | ||
Both React and Choo have a system that allows you to define of "this is what the | ||
DOM should look like". React uses JSX, and Choo uses Template String Literals. |
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.
Yes, although I don't think this guide should serve as a list of things that Choo has over React :P
</body> | ||
` | ||
} | ||
``` |
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.
An outro or a summary would be nice!
WIP