美文网首页
react-router4升级

react-router4升级

作者: black白先森 | 来源:发表于2018-04-21 22:31 被阅读12次
  1. react-router4升级
react-router-redux 主要 能在组件内用 store.dispatch(push('/)),
此功能可以用 history 代替
// history.js
import createHistory from 'history/createBrowserHistory';

const history = createHistory();

export default history;

// index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { Router } from 'react-router';
import history from './history';
import App from './app';

ReactDOM.render(
  <Router history={history}>
    <App />
  </Router>,
  document.getElementById('app')
);

react-router4 跟 redux 搭配,非路由组件,就是非直接匹配的 路由组件,
withRouter(connect(...)(App)), 这样App组件内 props上就可以获取路由参数了

相关文章

  • react-router4升级

    react-router4升级 react-router4 跟 redux 搭配,非路由组件,就是非直接匹配的 路...

  • react-router4代码分割

    react-router4代码分割 react-router4官方文档: https://reacttrainin...

  • 未看文章

    react-router4文档react-router4文档 # react-router 按需加载2.# 浅谈R...

  • react-code_split

    初始化工程目录 创建async-component.js 引用component 可以结合react-router4使用

  • 【React.js 13】react-router4基础知识-2

    除了上一篇所讲的3个入门组件BrowserRouter、Router、Link。react-router4其实还有...

  • react-router4按需加载踩坑,填坑

    react-router4如何去实现按需加载Component,在router4以前,我们是使用getCompon...

  • React-Router4

    React-Router4 4是全新的版本, 和之前的版本不兼容, 浏览器和 RN 均兼容 React 开发单页应...

  • react-router4

    一、关于react-router react-router是一些封装好的组件用于前端路由,当我们点击的时候会出现一...

  • react-router4

    react-router 有dom和native两种版本但是使用方法一致安装npm install react-r...

  • React-router4

    基础 React-router4是全新的版本,和之前版本不兼容,浏览器和React Native均兼容 React...

网友评论

      本文标题:react-router4升级

      本文链接:https://www.haomeiwen.com/subject/kygflftx.html