Why is it not mandatory to use inheritance in ReactJS?

In React, it is recommend using composition instead of inheritance to reuse code between components. Both Props and composition give us all the flexibility we need to customize a component’s look and behavior in an explicit and safe way. Whereas, If we want to reuse non-UI functionality between components, it is suggested to extracting it into a separate JavaScript module. Later components import it and use that function, object, or a class, without extending it.