GithubHelp home page GithubHelp logo

maddoxnelson / react-ssr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexnm/react-ssr

0.0 1.0 0.0 793 KB

A baseline for server side rendering for your React application

License: MIT License

JavaScript 100.00%

react-ssr's Introduction

React Server Side Rendering

A baseline for server side rendering for your React application. This repo has a couple of tags that follow building full support for rendering React applications on the server.

Getting started

Clone the repo with git clone https://github.com/alexnm/react-ssr

Install dependencies with npm i

Run dev mode with npm run dev

Now open the browser and navigate to http://localhost:2048 and you get your server rendered React app. You can inspect the page source and see that the html coming from your local server has all the nodes defined in the React app.

A few notes

  • I tried to limit the complexity of the entire app to focus on the server side rendering part. Don't take the same shortcuts in your production app!
  • We're starting the server with the index.js file which is in the root folder. This file loads the babel-register and sets up the babel plugins needed to run JSX and ESModules on the server.
  • The node server needs to handle the static files from the dist folder.
  • The entry point of the bundle is called client.js because it's the only part of our application that is not used for the server render.

Navigating through the different steps

Understand the different parts of server side rendering by going through each tag:

In depth explanations

Read more about implementing server side rendering step by step. Feedback is more than welcome!

react-ssr's People

Contributors

alexnm avatar foxmicha avatar

Watchers

James Cloos 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.