Skip to content

Commit

Permalink
fix: remove context from render
Browse files Browse the repository at this point in the history
  • Loading branch information
chaejunlee committed Dec 30, 2023
1 parent c3d2ffa commit 912adbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions playground/ssr-react/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ export async function createServer(
render = (await import('./dist/server/entry-server.js')).render
}

const context = {}
const appHtml = render(url, context)

if (context.url) {
// Somewhere a `<Redirect>` was rendered
return res.redirect(301, context.url)
}
const appHtml = render(url)

const html = template.replace(`<!--app-html-->`, appHtml)

Expand Down
4 changes: 2 additions & 2 deletions playground/ssr-react/src/entry-server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import ReactDOMServer from 'react-dom/server'
import { StaticRouter } from 'react-router-dom/server'
import { App } from './App'

export function render(url, context) {
export function render(url) {
return ReactDOMServer.renderToString(
<StaticRouter location={url} context={context}>
<StaticRouter location={url}>
<App />
</StaticRouter>,
)
Expand Down

0 comments on commit 912adbe

Please sign in to comment.