Skip to content

a simple implementation of server-side rendering and UI streaming in React from scratch with express.js as the server framework

License

Notifications You must be signed in to change notification settings

sina-byn/react-streaming

Repository files navigation

React SSR and UI Streaming with Suspense

This repository contains the code for implementing Server-Side Rendering (SSR) and UI Streaming from scratch in React using Suspense, as detailed in the article published on Medium.

Overview

This project demonstrates how to build a React application with Server-Side Rendering (SSR) and UI Streaming capabilities using the latest features of React, including Suspense. The goal is to improve the performance and user experience of React applications by rendering on the server and progressively streaming the content to the client.

Features

  • Server-Side Rendering (SSR): Render React components on the server to improve initial load times and SEO.
  • UI Streaming: Stream the rendered HTML to the client progressively, improving the time-to-interactive for the user.
  • React Suspense: Utilize React's Suspense for data fetching to manage loading states and code splitting.

Getting Started

Prerequisites

  • Node.js
  • npm or yarn

Installation

  1. Clone the repository :
$ git clone https://github.com/sina-byn/react-streaming.git
  1. Navigate to the project directory :
$ cd react-streaming
  1. Install dependencies :
$ npm install
# or
$ yarn install

Running the Application

  1. Start the server:
$ npm run start
  1. Open your browser and navigate to http://localhost:3000.

Learn More

For a detailed explanation and step-by-step guide, check out the accompanying article on Medium: Implement Server-Side Rendering and UI Streaming from scratch in React using Suspense.

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

License

This project is licensed under the MIT License.

About

a simple implementation of server-side rendering and UI streaming in React from scratch with express.js as the server framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published