O'Reilly logo

Developing a React Edge: The JavaScript Library for User Interfaces by The League of Extraordinary Developers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. Architectural Patterns

React renders HTML. You can consider it as the V in MVC, but it doesn’t make any decision if you use simple Ajax requests in your components directly like so:

var TakeSurvey = React.createClass({
  getInitialData: function () {
    return {
      survey: null
    };
  },
  componentDidMount: function () {
    $.getJSON('/survey/' + this.props.id, function (json) {
      this.setState({survey: json});
    });
  },
  render: function () {
    if (!this.state.survey) return null;

    return <div>{this.state.survey.title}</div>;
  }
});

Or if you use an MVC framework, and thus it can easily be integrated in most application architectures.

In this chapter we will go over a few approaches or libraries you could use with React to help structure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required