Git Product home page Git Product logo

universal-react-router4's Introduction

universal-react-router4

A Demo app showing how to use react-router v4 for server- and client-side rendering.

Similar to the demo app Ryan Florence shows in his introductory video for react-router 4, this app fetches data about Gists from the GitHub API and displays them. The difference is that in this demo, the markup of the page is initially rendered on the server side, and when the user clicks on one of the links, the Gist data is rendered on the client side without another request to the server, using the same React components and react-router link elements that the backend is using (hence “universal”).

How to Run

You should have a current version of Node.js installed. Version 6.9 is recommended.

Install the node modules used by the application:

npm install

Build JavaScript bundles for the server- and client-side code using webpack:

npm run build

Run the application:

npm start

You can then go to localhost:3000 in your favorite browser to see the Gists.

Local Development

To speed up local development when working on the source code, you can start the application in watch mode.

You need to run each of the following commands in a separate terminal.

To automatically rebuild the client JavaScript bundle when client source code changes:

npm run dev:client

To automatically rebuild the server JavaScript bundle when client source code changes:

npm run dev:server

To run the server and automatically restart it when the server bundle changes:

npm run dev:start

License

Published under the MIT License.

Copyright © 2017 mobile.de GmbH

universal-react-router4's People

Watchers

 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.