A
A
Andrew2017-03-21 15:19:59
JavaScript
Andrew, 2017-03-21 15:19:59

How and where are elements rendered? when are objects created?

What happens after the render method? just all the elements from the render mentor are passed as objects to the virtualDOM and compared to the DOM? tell me more.

import React, { Component, PropTypes } from 'react';
import Section from './section';

class Content extends Component {
  constructor() {
    super();
    console.log(this);
  }

  makeSomeArrow = () => {
    console.log('arrow');
  }

  maskeSomeShort() {
    console.log('short');
  }

  render() {
    return (
      <Section/>
    );
  }
}

Content.propTypes = {
  movies: ImmutablePropTypes.list,<code lang="javascript">

</code>
  boundGetContent: PropTypes.func,
  token: PropTypes.string
};

export default Content

import React, { Component } from 'react';

class Section extends Component {
  render() {
    return (
      <div>
        Content
      </div>
    );
  }
}

export default Section;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2017-03-21
@AppFA

Well, after all, everything is transpiled into React.createElement(Section, { ...props }), and already inside the VirtualDom it goes through all these elements and creates their instances. Where Section is your class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question