Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If I understand correctly, the team is pretty clear that if they had written React from scratch today, they would have gone with functional components and not class components.

The major issue is life cycle. When is a class component instance created or destroyed? The answer is "whenever the framework feels like it," and that's a really ugly model for instance life cycle. Additionally and most importantly, it means that member variables on a React class component instance don't work the way that members are expected to work; you just can't rely on them having any particular value because the framework can create or destroy an instance when it feels like it for performance reasons. What good is a class and instance abstraction if when you try to use member variables (one of the key features of object-oriented programming) you're highly likely to just break the model in hard-to-debug ways?

Because the framework isn't using class component instances like instances are supposed to be used, the React team is tossing that model to the curb.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: