Coder Social home page Coder Social logo

react-server-rendering-example's Introduction

react-server-rendering-example

An example of React server-side rendering with express-react-views view engine

###how to run

server_rendering/

$ npm install
$ ./node_modules/.bin/webpack
$ npm start

Then navigate to http://localhost:3000 and click on the button to see some reactive events in action.

server_rendering/

  • Express framework
  • Only JSX template file to write
  • Upgrade to javascript ES6
  • Render react on the document instead of some <child id='container'>
  • Rename express-react-views index.js to jsxTemplate.js because renderToString is needed for server rendering

react-server-rendering-example

express-react-viewsReact服务器渲染例子🌰

##如何运行

server_rendering/

$ npm install
$ ./node_modules/.bin/webpack
$ npm start

在浏览器打开http://localhost:3000点击界面按钮,会看到数字在递增.

###tech glimpse server_rendering/

  • Express框架
  • 只需要写.jsx文件即可
  • 升级javascript语法到ES6
  • 直接将react挂在到DOM根节点上,即document
  • 重命名 express-react-views index.jsjsxTemplate.js 因为服务器渲染需要 renderToString

react-server-rendering-example's People

Contributors

geemaple avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-server-rendering-example's Issues

启动报错

dering\node_modules_node-sass@3.13.1@node-sass\lib\binding.js:13
throw new Error(errors.unsupportedEnvironment());
^

Error: Node Sass does not yet support your current environment: Windows 64-bit w ith Unsupported runtime (57)

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.