We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
疑问: ReactDOM.hydrate 会覆盖服务端渲染的结果,而服务端渲染的时候,会传递一些参数来完成页面渲染,而客户端不执行ReactDOM.hydrate,相关事件就无法触发,而只能引入Jq来完成事件绑定。
代码实例
export default class View extends React.Component<ViewProps> { static getPartial(props: IProps) { const {ctx} = props; return { html: <Login location={ctx.req.url} appType={props.appType} csrf={props.ctx.csrf}/> } } render() { const {html, helper} = this.props; return ( <html> <head> <title>TypeScript</title> <script src={helper.asset('../resource/js/jquery-1.11.0.min.js')}/> <link rel="stylesheet" href={helper.asset('login.css')}/> </head> <body> <div id="loginView" dangerouslySetInnerHTML={{ __html: html }} /> </body> <script src={helper.asset('../resource/client/js/login.jq.js')}/> <script src={helper.asset('manifest.js')}/> <script src={helper.asset('login.js')}/> </html> ); } } /** * 浏览器客户端运行 * 包含事件 */ if (__CLIENT__) { ReactDOM.hydrate(<Login/>, document.getElementById('loginView')); }
The text was updated successfully, but these errors were encountered:
@njugray 麻烦有时间,辛苦解答一下我的疑惑
Sorry, something went wrong.
参数你要通过 挂 window的方式,客户端拿到结果,hydrate一个一样的 <Login location={ctx.req.url} appType={props.appType} csrf={props.ctx.csrf}/>
<Login location={ctx.req.url} appType={props.appType} csrf={props.ctx.csrf}/>
No branches or pull requests
疑问:
ReactDOM.hydrate 会覆盖服务端渲染的结果,而服务端渲染的时候,会传递一些参数来完成页面渲染,而客户端不执行ReactDOM.hydrate,相关事件就无法触发,而只能引入Jq来完成事件绑定。
代码实例
The text was updated successfully, but these errors were encountered: