如何使用Reuxjs.Net与Redux一起进行服务器端渲染?

时间:2021-09-05 15:54:52

I'm trying to do server side rendering with an application made in ASP.NET MVC, using ReactJS and Redux. I'm using ReacJS.Net.

我正在尝试使用ReactJS和Redux在ASP.NET MVC中创建的应用程序进行服务器端渲染。我正在使用ReacJS.Net。

My components are fine with client rendering.

客户端渲染我的组件很好。

My application could be the one of the example from here : http://redux.js.org/docs/basics/UsageWithReact.html. Here the main code (for client rendering) .

我的应用程序可以是这里的示例之一:http://redux.js.org/docs/basics/UsageWithReact.html。这里是主要代码(用于客户端渲染)。

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import todoApp from './reducers'
import App from './components/App'

let store = createStore(todoApp)

render(
  <Provider store={store}>
     <App />
  </Provider>,
 document.getElementById('root')
)

How to do this with ReacJS.NET with server-side rendering ?

如何使用ReacJS.NET进行服务器端渲染?

1 个解决方案

#1


0  

I think you should start here. I'm not sure about Redux but this explains a lot:

我想你应该从这里开始。我不确定Redux,但这解释了很多:

https://reactjs.net/guides/server-side-rendering.html

And there's also a really good example of Server side react rendering:

还有一个非常好的服务器端反应渲染示例:

https://github.com/systempioneer/React-Umbraco-Example

it's build with Umbraco, but Umbraco is an MVC based CMS so you can pretty much figure out the basics.

它是用Umbraco构建的,但Umbraco是一个基于MVC的CMS,所以你几乎可以找出基础知识。

#1


0  

I think you should start here. I'm not sure about Redux but this explains a lot:

我想你应该从这里开始。我不确定Redux,但这解释了很多:

https://reactjs.net/guides/server-side-rendering.html

And there's also a really good example of Server side react rendering:

还有一个非常好的服务器端反应渲染示例:

https://github.com/systempioneer/React-Umbraco-Example

it's build with Umbraco, but Umbraco is an MVC based CMS so you can pretty much figure out the basics.

它是用Umbraco构建的,但Umbraco是一个基于MVC的CMS,所以你几乎可以找出基础知识。