Giter Club home page Giter Club logo

react-jsx-server-side's Introduction

react-jsx-server-side

Documentación en español aquí

A simple demo showing how one can render a ReactJS application server-side (in NodeJS), without losing reactivity on the client. It was entirely inspired by this article published by Charlie Marsh (August 2014), as well as the valuable resources he recommends at the end, so if you need to know more about what this is all about, read it!

This is a simple demo, don't use it in production.

Getting Started

  • Install dependencies $ npm install
  • Start the server $ npm start
  • Have fun with that amazing button at localhost:3000
  • Explore the code

Features

  • On the server you can transparently require() JSX code thanks to node-jsx.
  • React components are required(), compiled and rendered in a per-request basis. You can edit the .jsx files and the server will always send a fresh updated html markup to the client in every request, without having to restart the server, much like you would with most templating systems such as jade or ejs.
  • The browser receives the whole application code (including react) in a unique bundle thanks to connect-browserify This file is also re-bundled automatically whenever a change is made to the app code.

Note: This demo uses some dirty hacks only suitable for development stage and really bad for production, in such a case:

  • Don't use node-jsx, use react-tools to compile all your JSX code to JS before require() it.
  • Don't use connect-browserify to generate the bundle.js on the server, instead use Grunt or Gulp to compile, minify and compress everything in a previous step, serve the bundle as a simple static file.
  • On the server you should render the HTML markup just once at server startup, and NOT in every request.

Last updates:

0.0.3 / 2014-09-03

  • add a middleware to clear .jsx files from require cache in every request
  • add watch: true option to connect-browserify to re-bundle when editing
  • update documentation

See History.md for a complete list of changes.

react-jsx-server-side's People

Contributors

juanmac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jondotsoy xgrommx

react-jsx-server-side's Issues

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.