Ravikumar Gunge
Ravikumar Gunge

Reputation: 1

What do these two files reactjs and reactDOM do?

Today I'm done with my hello world example with ReactJS,

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script>

Above two CDN's included, Just wants to know, what is the difference between them, why do we need to include them, what is the purpose?

Upvotes: 0

Views: 86

Answers (1)

rdiz
rdiz

Reputation: 6176

They're meant for detaching the actual logic and processing that React does, from the DOM interaction. react-dom is simply used for rendering react components into the DOM, finding DOM elements so that React can interact with them. ReactDOM actually only serves us three methods:

  • findDOMNode, which finds a DOM node from fx. a React ref
  • render which renders a React component at a specific place in the DOM, and
  • unmountComponentAtNode which does the opposite of render (removes it)

Upvotes: 2

Related Questions