Say I have a component like, // first approach (SPA) const Component = () => { const [show, toggle] = React.useReducer(show => !show, false) return ( <div> {show && <div>content1</div>} {!show && <div>content2</div>} </div> ) } And say I decide to rewrite it as, // second approach (toggling 'display' attribute) const Component = () => { const [show, toggle] = React.useReducer(show => !show, false) return ( <div> <div style={!show ? { display:...
Originally asked by legoMyEgo on Stack Exchange (webmasters) (CC BY-SA 4.0).