3 ms·
People seem to forget that components (stateless components, stateless functional components or whatever you want to call them) are just functions. One function
by wereHamster 9y ago
People seem to forget that components (stateless components, stateless functional components or whatever you want to call them) are just functions. One function calls another function, that's function composition. In plain JavaScript we do it all the time. But when React is involved people are suddenly all like: no you can't call that function directly, you have to name it 'Component' with a capital C and use like '<Component />' and to compose two Components you have to use a HOC. It's like they all forget how to JavaScript…
- deleted 9y ago[deleted]
- baddox 9y agoAn HOC is a plain JavaScript function that accepts a React component (and maybe other things) and returns a React component. I don’t think your complaint applies to HOCs, because they are literally an example of your suggestion to just use plain functions.