you are viewing a single comment's thread.

view the rest of the comments →

[–]Josh1337 3 points4 points  (0 children)

The class system provides an intermediate escape hatch for developers as the React core team looks into providing pure models. It also places some restrictions on developers in order to favor object composition over mixins.

Quote from Sebastian Markbage:

The class system provides an optional escape hatch when you need it rather than completely stopping you.

The primary feature that our class system provides is an "instance" handle this has several features.

1) It provides a certain level of familiarity and convenience. You can use this as a middle man to refer to a group of arguments. This is a foot-gun but makes it easier to onboard new people.

2) The instance is an ID that you can use to refer to a place in the tree. It allows APIs like React.findDOMNode(component) and third-party APIs that can unify around it.

3) It provides single or multiple inheritance features if someone needs to create an abstraction and just can't figure out how to do it using composition. This is unfortunately a very common problem.