GithubHelp home page GithubHelp logo

rbromley10 / react_ssr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ootsuka/react_ssr

0.0 1.0 0.0 11.68 MB

a react server side render project

License: MIT License

JavaScript 93.73% Dockerfile 1.93% CSS 4.34%

react_ssr's Introduction

React_SSR

React Server Side Rendering Boilerplate

This project demonstrates the basics of how to implement Server Side Rendering (SSR) using React.

What's included?

  • Server Side rendering React
  • Webpack configuration
  • Build Routing in SSR
  • Use Redux with SSR
  • Make Node server fetch data with proxy
  • Create HOC to style components
  • Use React Loadable to do code splitting <<<<<<< HEAD
  • Build 404 page and 301 redirect on server side =======
  • Build 404 page and 301 redirect
  • Dockerized for production

Initial Setup

npm install

Development

npm run dev

Production

npm run prod

General Architecture

The src code has two parts, server and client code. Server is a express application whose purpose is to handle user request, fetch data, generate content and return the response to the user. Server/util renders react component to String and inject the html string into response. Fetching data on the server side is done with a static loadData method to the highest class component rendered for a route, the method returns a promise which will be resolved with other promises in Server/index.js to guarantee the store gets all the data before rendering. loadData is added to Routes.js as a property for a route object so it can be accessed with { matchedRoutes } <<<<<<< HEAD Client Part is just a standard react application with some components. Footer/AsyncComponent.js is a dynamically imported component for purpose of testing out code splitting with React Loadable. We use react-router-dom's context to help achieve 404 page and 301 redirect on the server.

Client Part is just a standard react application with some components. Sidebar/Math.js is a dynamically imported component for purpose of testing out code splitting with React Loadable.

94de39019765a073dbe61268fef0610f46016f9c

RoadMap

  • Add test for the project.
  • Conditionally load pollyfills

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.