Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented Jan 11, 2018

WIP

  • diffing model
  • forms / controlled-components
  • more words on jsx vs choo templates
  • redux vs event emitter
  • debug tooling
  • history API

@yoshuawuyts yoshuawuyts changed the title init react migration document how to migrate from react Jan 11, 2018
@gregtatum
Copy link

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.

@yoshuawuyts
Copy link
Member Author

@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.
Copy link
Member

@YerkoPalma YerkoPalma Jan 12, 2018

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.

Copy link

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}>
Copy link
Member

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
Copy link

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.
Copy link

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>
`
}
```
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants