【发布时间】:2017-11-21 01:24:34
【问题描述】:
我对 react-redux 非常感兴趣,阅读了托管实际应用程序的方法,并提出 Express 中间件是我想做的最好的。 我在尝试弄清楚如何为 react-redux 实现服务器端属性时遇到问题,因为我注意到语法中的部分代码我是新手。
这是服务器端的代码。
import path from 'path'
import Express from 'express'
import React from 'react'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import counterApp from './reducers'
import App from './containers/App'
const app = Express()
const port = 3000
//Serve static files
app.use('/static', Express.static('static'))
// This is fired every time the server side receives a request
app.use(handleRender)
// We are going to fill these out in the sections to follow
function handleRender(req, res) { /* ... */ }
function renderFullPage(html, preloadedState) { /* ... */ }
app.listen(port)
好的,所以我不知道这个带花括号的部分是什么意思:
import { createStore } from 'redux'
import { Provider } from 'react-redux'
是否需要在 React-Redux 的服务器 express 代码中使用 ES6/JSX/Babel 语法?
【问题讨论】:
标签: javascript express react-redux babeljs react-jsx