Re:Prefer duplication over the wrong abstraction
by theodorton on Saturday July 09, 2016 @01:46PM
(#12062452)
Been bitten by this in React using ES6 where we would sub-class components and override render to provide another layout (or whatever; change behavior).
The right way to do it in React is to define a new Component and make the Component you'd like to depend on wrap around the returned JSX in render instead. Probably not a revolutionary paradigm, but it has made me better at reasoning about and structuring React components.
The right way to do it in React is to define a new Component and make the Component you'd like to depend on wrap around the returned JSX in render instead. Probably not a revolutionary paradigm, but it has made me better at reasoning about and structuring React components.