4 ms·
Same way you compose functions or HTML elements. Functions: add(1,multiply(2,3)) HTML: <div>foo <span>bar</span> </div> React: <Container> <He
by wereHamster 11y ago
Same way you compose functions or HTML elements.
Functions:
add(1,multiply(2,3))
HTML:
<div>foo <span>bar</span> </div>
React:
<Container> <Header>foo</Header> <p>content</p> </Container>
- Bahamut 11y agoTo be pedantic, that is not quite composition - I've made this exact mistake before too. Composition is where you have a function f o g (o being the traditional mathematical notation for composition), where (f o g)(a) = b satisfies g(f(a)) = b. Composition is a useful tool, and so is writing functions like this, but they are two different ideas.