cliff-effects icon indicating copy to clipboard operation
cliff-effects copied to clipboard

Switch to component classes instead of stateless functional components?

Open turnerhayes opened this issue 7 years ago • 3 comments

Wanted to bring this up for discussion; it appears that Stateless Functional components (i.e. components declared as simple functions, not classes) are not (easily) selectable in React Devtools (intentionally). The $r shortcut is really useful for inspecting state and props. Should we convert our components to class components?

turnerhayes avatar Nov 06 '18 23:11 turnerhayes

I believe Hot Module Reloading is also not available with SFCs (although not 100% on that).

turnerhayes avatar Nov 06 '18 23:11 turnerhayes

Hot reloading is fun, it's true. Can you link to an article or two on the advantages of stateless functional components so we can weigh pros and cons?

knod avatar Nov 07 '18 12:11 knod

I'm a little skeptical, this seems like a lot of refactoring for what strikes me as a minor convenience for developers. IIRC, quite a few of the components in the app are SFCs already.

dylanesque avatar Nov 11 '18 02:11 dylanesque