Skip to content

Commit

Permalink
fix: update ssr-with-rax
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Mar 11, 2020
1 parent 579c08b commit 27e885c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/ssr-with-rax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ssr-with-js",
"version": "2.3.0",
"dependencies": {
"driver-universal": "^3.1.3",
"driver-dom": "2.0.7-1",
"egg": "^2.21.0",
"egg-scripts": "^2.11.0",
"egg-static": "^2.2.0",
Expand Down
9 changes: 4 additions & 5 deletions example/ssr-with-rax/web/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import Layout from '@/layout'
import { routes } from '../config/config.ssr'

function Component () {
const raxRoutes = routes.map(item => {
const raxRoutes = routes.map((item, index) => {
const Component = raxGetWrappedComponent(item.Component())
item.component = () => <Layout><Component /></Layout>
item.component = () => <Layout key={`layout${index}`}><Component /></Layout>
return item
})

Expand All @@ -20,13 +20,12 @@ function Component () {
}

const component = useRouter(config).component
window.raxComponent = component
return component
}

const clientRender = () => {
const DriverUniversal = require('driver-universal').default
render(<Component />, document.body, { driver: DriverUniversal, hydrate: true })
const DriverUniversal = require('driver-dom')
render(<Component />, document.getElementById('app'), { driver: DriverUniversal, hydrate: true })
// hmr存在问题,先关掉,采用刷新的策略,有兴趣的同学可以帮忙修复
// if (process.env.NODE_ENV === 'development' && module.hot) {
// module.hot.accept()
Expand Down

0 comments on commit 27e885c

Please sign in to comment.