Components like the <Sidebar /> and <Modal /> are used different from most other components. Instead of nesting an instance of them wherever they are used, a single instance of these components is added to the root of the application. To interact with them, we use methods instead.
Prior to this PR, those methods were defined on a model, which had to be required separately. This is mainly a matter of taste, but I think this does make it a bit less complex. Following @davegonzalez's feedback, those methods are defined on the component class itself.
What changed
All the methods and state held within the model of a connected component are set as static properties on the component itself.
Overview
Components like the
<Sidebar />
and<Modal />
are used different from most other components. Instead of nesting an instance of them wherever they are used, a single instance of these components is added to the root of the application. To interact with them, we use methods instead.Prior to this PR, those methods were defined on a model, which had to be required separately. This is mainly a matter of taste, but I think this does make it a bit less complex. Following @davegonzalez's feedback, those methods are defined on the component class itself.
What changed
All the methods and state held within the model of a
connect
ed component are set as static properties on the component itself.