GithubHelp home page GithubHelp logo

react-app's Introduction

react-app

Express application which serves pre-rendered React components and corresponding client code. Can be used for rapid experimentation and application development with React library.

Main features:

  • UI pre-rendering on a server
  • HTML5 History navigation
  • Browserified client code bundles
  • Debug mode which features fast bundle rebuilds and source map support

Quickstart

Install react-app npm module:

% npm install git+https://github.com/andreypopp/react-app.git

Initialise react-app express application with route table:

% cat <<EOF
var makeApp = require('react-app');
makeApp({
  '/': './index_page.jsx',
  '/about: './about_page.jsx'
}).listen(3000);
EOF > index.js

Now create index_page and about_page components:

% cat <<EOF
/**
*
* @jsx React.DOM
*
*/

var React = require('react-tools/build/modules/React'),
    Page = require('../../page.js');

module.exports = React.createClass({
  render: function() {
    return this.transferPropsTo(
      <Page>
        <head>
          <title>Index</title>
        </head>
        <body>
          <h1>Hello, index!</h1>
          <a href="/pages/about">About page</a>
        </body>
      </Page>
    );
  }
});
EOF> ./index_page.jsx

% cat <<EOF
/**
*
* @jsx React.DOM
*
*/

var React = require('react-tools/build/modules/React'),
    Page = require('../../page.js');

module.exports = React.createClass({
  render: function() {
    return this.transferPropsTo(
      <Page>
        <head>
          <title>About</title>
        </head>
        <body>
          <h1>Hello, about!</h1>
          <a href="/">index</a>
        </body>
      </Page>
    );
  }
});
EOF > ./about_page.jsx

react-app's People

Contributors

andreypopp avatar petehunt avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.