0.1.9 • Published 5 years ago

react-carvel v0.1.9

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-carvel

A painless react server side rendering middleware

Features

  • Stream & string mode rendering
  • Gzip compression on stream & string rendering
  • Rendering cache
  • Styled-component & sass & less
  • Cookie & token base credential
  • Only few change when apply to exists or new react project
  • use exists client routing
  • Base on koa

Usage

Base on project create by create-react-app & react-router-dom

  • Install packages

    yarn add react-carvel react react-dom react-router-dom \
    koa koa-router koa-static
  • Update index.js

    Use App.js and render elements with hydrate or render accordingly

    import React from 'react';
    import ReactDOM from 'react-dom';
    import Root from './root-client';
    import * as serviceWorker from './serviceWorker';
    
    const rootElement = document.getElementById('root');
    const renderOrHydrate = rootElement.children.length ? 'hydrate' : 'render';
    ReactDOM[renderOrHydrate]((
        <Root />
    ), rootElement);
    
    // If you want your app to work offline and load faster, you can change
    // unregister() to register() below. Note this comes with some pitfalls.
    // Learn more about service workers: http://bit.ly/CRA-PWA
    serviceWorker.unregister();
  • Create server & use react-carvel middleware

    TBD

  • create build config & script

    TBD

  • Start server & checking

    now ssr is working

options

TBD

License

MIT © Minocoko

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago