marcus-grant/pattern-ui

Change ListSection to stateful class

marcus-grant opened this issue · 1 comments

Functional components aren't faster yet. So this is premature optimisation that makes managing thecollapse state needlessly more complex. The only state then becomes is isCollapsed and a new prop is then needed to specify if it isCollapsible.

Handled in commit 1c13e80. ListSection is now a component class with a single state isCollapsed and it determines if the dataSection gets rendered with cellRenderer, otherwise only headerRenderer renders anything. The state is blocked from changing from being false by the prop isCollapse using short-circuiting logic.