服务器端 React-Redux,Express,没有额外的 ES6 和 JSX 语法

Server side React-Redux, Express with no additional ES6 and JSX syntax

我对 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 的服务器快速代码中使用 ES6/JSX/Babel 语法?

这与您的代码逻辑无关。这只是从库中导入导出的 submodules/functions 的一种方法。

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/import

import { createStore } from 'redux'

相同
let createStore = require('redux').createStore