What is the difference between a "composite component" and a "DOM component" in react?
The official docs contrasts the two terms to each other in a few places, but never really explains them. Eg: https://facebook.github.io/react/docs/component-specs.html https://facebook.github.io/react/docs/working-with-the-browser.html
From react 0.14 a few of test utils methods, like findRenderedDOMComponentWithClass no longer takes "DOM components".
What are compound components in React? Compound components are a pattern in which components are used together such that they share an implicit state that lets them communicate with each other in the background.
Reason for composition over inheritance children, we can separate code in the separated places. We do not need to go very deep in the components and create many ifs. The next important thing. With composition, we follow the “everything is component” model designed by React.
What is the DOM? The DOM (Document Object Model) represents the web page as a tree structure. Any piece of HTML that we write is added as a node, to this tree. With JavaScript, we can access any of these nodes (HTML elements) and update their styles, attributes, and so on.
React components are independent and reusable code. They are the building blocks of any React application. Components serve the same purpose as JavaScript functions, but work individually to return JSX code as elements for our UI.
It is clearly defined in the test-utils page. So DOM component is really a plain div or a span. Unlike a CompositeComponent that can be a div, but created but by the React.createClass().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With