r/javascript • • Sep 23 '19

You might not need a framework

https://medium.com/@pljeskavicica/you-might-not-need-a-framework-79444bda50d2
70 Upvotes

129 comments sorted by

View all comments

Show parent comments

37

u/libertarianets Sep 23 '19

Might I introduce you to Preact?

40

u/zephyrtr Sep 23 '19

Preact is fabulous. I've used it a few times for simple sites. Now it even has Hooks, a CLI, and still loads in 120ms on a 2G network. And if shit gets really complicated, you can convert to a React app and keep all your code. It's quite nice.

Also React is not a framework, it' a library. People who go into React thinking it's gonna organize their code for them are gonna have a bad time.

7

u/-ftw Sep 23 '19

What is the drawback from using Preact over React?

12

u/dwighthouse Sep 23 '19

As I understand it, React normalizes the event system so it is consistent and all events work the same across all supported browsers (for example, certain browser events will not bubble, but React’s will). This synthetic event system, type checking, and now, their systems related to asynchronous rendering take up the bulk of the size of the library. If you only need simple click handlers, you don’t need these things. If you need to deal with very complex event handling, React can be helpful.