node.js - server side rendering rendering and optimisations in react node app -


i have file:

import react, {component, proptypes} 'react'; import reactdom 'react-dom/server'; import serialize 'serialize-javascript'; import helmet 'react-helmet'; import googletagmanager '../../src/components/commons/footer/googletagmanager'  /**  * wrapper component containing html metadata , boilerplate tags.  * used in server-side code wrap string output of  * rendered route component.  *  * thing component doesn't (and can't) include  * html doctype declaration, added rendered output  * server.js file.  */ class html extends component {    constructor(props){     super(props);      this.zopimintegration = this.zopimintegration.bind(this);   }      render() {     const {assets, component, store, html} = this.props;     const content = component ? reactdom.rendertostring(component) : '';     return (       <html lang="en-us">       <head>           {object.keys(assets.styles).map((style, key) =>           <link href={assets.styles[style]} key={key}                 rel="stylesheet" type="text/css"/>         )}         <link name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>          <meta name="viewport" content="width=device-width, initial-scale=1"/>         { object.keys(assets.styles).length === 0 ? <style           dangerouslysetinnerhtml={{__html:  require('../styles/common_style.scss')._style}}/> : null         }       </head>       <body>       <div id="app" dangerouslysetinnerhtml={{__html: html}}></div>       <script dangerouslysetinnerhtml={{__html: `window.__data=${serialize(store.getstate())};`}} charset="utf-8"/>       <script src={assets.javascript.main} charset="utf-8"/>       <div classname="nanorep_loadingdata" id="nanorepproxycontainer" aria-live="polite" style={{position:'absolute', top: '-500px', left: 0}} />        </body>       </html>     );   } }  html.proptypes = {   assets: proptypes.object,   component: proptypes.node,   store: proptypes.object,   finalstate: proptypes.object,   html: proptypes.node };  export default html; 

so believe page server side rendered , components client side rendered?

i not idea of downloading js file entire application on application startup since of course blocking file , slow down rendering.

how use webpack splits improve rendering time?

what other ways there optimize react-node application?

i using compression in expression, minifying files.

caching using express minify:

app.use(minify({   cache: true })); 

do have more ways optimize further?


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -