首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏lhyt前端之路

    记一次preact迁移到react16.6.7的经历

    必须保证后面用到this.state之前,对state有初始化,否则是null 3. preact相关的router迁移回react生态 首先,import的preact-router得换成react-router preact-router: <Router history={history}> <Main path="/" history={history} /> path="/new_user" history={history} component={NewUser} />

    </Router> 复制代码 preact-router 实际上底层就是封装history路由加上内部的setstate: import { route } from 'preact-router'; route('/a'); 复制代码 问题来了,如果没有这个方法 异步路由 用preact-router的时候,有些组件是异步的: <Router history={history}> { trackRoute() }

    1.3K40发布于 2019-03-14
  • 来自专栏IMWeb前端团队

    记一次preact迁移到react16.6.7的经历

    必须保证后面用到this.state之前,对state有初始化,否则是null 3. preact相关的router迁移回react生态 首先,import的preact-router得换成react-router preact-router: <Router history={history}> <Main path="/" history={history} /> Route path="/new_user" history={history} component={NewUser} />

    </Router> preact-router 实际上底层就是封装history路由加上内部的setstate: import { route } from 'preact-router'; route('/a'); 问题来了,如果没有这个方法,想用脚本跳转路由怎么办 异步路由 用preact-router的时候,有些组件是异步的: <Router history={history}> { trackRoute() }

    91020发布于 2019-12-04
  • 来自专栏IMWeb前端团队

    移动端项目快速升级 react 16 指南

    本文作者:IMWeb EnjoyChan 原文出处:IMWeb社区 未经同意,禁止转载 背景 考虑到移动端性能,腾讯企鹅辅导移动端项目使用了更为轻量的 preact(7KB) 及其对应配套 preact-router

    1.7K20发布于 2019-12-04
  • 来自专栏李成熙heyli

    Preact -- React的轻量解决方案

    而Preact也有提供preact-redux和preact-router,甚至还有帮助Preact做同构直出的preact-render-to-string。

    2.3K50发布于 2018-01-05
  • 领券