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

Preact instead of React? #23

Open
11111000000 opened this issue Aug 28, 2016 · 3 comments
Open

Preact instead of React? #23

11111000000 opened this issue Aug 28, 2016 · 3 comments

Comments

@11111000000
Copy link

11111000000 commented Aug 28, 2016

Preact aims to deliver on a few key goals:

  • Performance: Render quickly & efficiently
  • Size: Small size, lightweight (approximately 3.5kb)
  • Efficiency: Effective memory usage (recycling, avoiding GC thrash)
  • Understandability: Understanding the codebase should take no more than a few hours
  • Compatibility: Preact aims to be largely compatible with the React API. preact-compat attempts to achieve as much compatibility with React as possible.
@11111000000
Copy link
Author

11111000000 commented Aug 28, 2016

What's Missing?

  • PropType Validation: Not everyone uses PropTypes, so they aren't part of Preact's core.
    PropTypes are fully supported in preact-compat, or you can use them manually.
  • Children: Not necessary in Preact, because props.children is always an Array.
    React.Children is fully supported in preact-compat.
  • Synthetic Events: Preact's browser support target does not require this extra overhead.
    A full events implementation would mean more maintenance and performance concerns, and a larger API.

What's Different?

Preact and React have some more subtle differences:

  • render() accepts a third argument, which is the root node to replace, otherwise it appends. This may change slightly in a future version, perhaps auto-detecting that a replacement render is appropriate by inspecting the root node.

@11111000000 11111000000 changed the title Preact instad of React? Preact instead of React? Aug 28, 2016
@Wildhoney
Copy link
Owner

👍 +1 for Preact.

@neverfox
Copy link
Contributor

It would still support React, right?

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

No branches or pull requests

3 participants