6

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".

2
  • 2
    Aren't just DOM components those that are already exist, such as <div>, <input> etc. and composite components are those that you define yourself, <Mycomponent /> and other components consisting of compositions of components?
    – Daniel B
    Oct 13, 2015 at 10:07
  • Not sure, that's why I'm asking:) Just found this article (mattzabriskie.com/blog/react-referencing-dynamic-children) which implies that a "composite component" simply is a component made up of multiple components.
    – swelet
    Oct 13, 2015 at 19:19

1 Answer 1

7

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().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.