Link & Redirect
【Link】
Link标签,用于实现React-Router功能的跳转。(意思是就不要使用a标签了)
1)to:string,指明要跳转的path。
import { Link } from 'react-router-dom'
<Link to="/about">About</Link>
2)Link的牛逼之处,就是可以拼完整url。
to:object,指明要跳转的path、query、state。
<Link to={{
pathname: '/courses',
search: '?sort=name',
hash: '#the-hash',
state: { fromDashboard: true }
}}/>
3)replace,When true, clicking the link will replace the current entry in the history stack instead of adding a new one.
<Link to="/courses" replace />
【Redirect】
Redict会直接跳转到新地址。
import { Route, Redirect } from 'react-router'
<Route exact path="/" render={() => (
loggedIn ? (
<Redirect to="/dashboard"/>
) : (
<PublicHomePage/>
)
)}/>
参考:https://reacttraining.com/react-router/web/guides/quick-start
Link & Redirect的更多相关文章
- javascript,HTML,PHP,ASP做301跳转代码 SEO优化设置
URL HTTP Redirection URL http redirection is an automatic URL change operation from one URL to anoth ...
- php防盗链,php ci在control里面控制除了自己站内的链接点击跳转,其他来源的都跳到站内页面
php防盗链,php ci在control里面控制除了自己站内的链接点击跳转,其他来源的都跳到站内页面 $route['jump/(:any)/(:any)'] = "index/jump/ ...
- react-router详细解释
react-router的理解 react的一个插件库,专门用来实现一个SPA应用(单页Web应用(single page web application,SPA)整个应用只有一个完整的页面,点击页面 ...
- react 路由导航栏 withRouter
codesandbox https://codesandbox.io/s/9l6prnyxjy app.js import React, { Component, Fragment } from &q ...
- react-router 4.0(三)根据当前url显示导航
import React, { PropTypes } from 'react' import ReactDOM from 'react-dom' import { HashRouter, Route ...
- React-router4 第八篇 ReactCSSTransitionGroup 动画转换
https://reacttraining.com/react-router/web/example/animated-transitions 动画转换这么高级,其实是又引入了一个组件,没什么特别, ...
- React中路由的基本使用
现在我们来搞一搞React中的路由吧,别问我为什么这木喜欢用搞这个字,因为它比较深奥. 注意下面我们使用的是React-Router-DOM React中的路由基本使用还是满简单的,零碎的小东西有点多 ...
- React-router4 第三篇 BasicURL ParametersRedirects (Auth) 谷歌翻译:重定向
依旧是地址 https://reacttraining.com/react-router/web/example/auth-workflow 上来一步走 先导入模块 import React, { P ...
- wordpress必装的插件 wp最常用的十个插件
wordpress是世界上著名的博客系统,简称wp.一般新安装完wordpress以后,往往需要首先安装一些插件,这样才可以使用wordpress的更多功能.wp最常用的十个插件有哪些呢,可能根据每个 ...
随机推荐
- access oarcle
1 默认值2 自动增加字段3 now() time() date() 更改sysdate4 datediff5 保留字 date 名字段6isnull(rowname)要改成rowname = nul ...
- SAP系统中ASCS、ERS、PAS、AAS
SAP系统中ASCS.ERS.PAS.AAS是什么: ASCS:ABAP Central services instance (Message server) PAS: Primary applica ...
- zabbix监控java日志文件
zabbix监控日志文件 https://blog.csdn.net/workdsz/article/details/78439230?utm_source=blogxgwz2
- linux常用命令以及快捷键
find命令查找某些文件并将其拷贝到指定目录 [root@host lib]# find -name "*hbase*.jar" |xargs -i cp {} /root/aa ...
- django的i18n是如何实现的
在程序中出现 _的地方会调用gettext_lazy(django.utils.translation.py) class LogEntry(models.Model): action_time = ...
- leetcode1024
class Solution(object): def videoStitching(self, clips: 'List[List[int]]', T: int) -> int: li = s ...
- Ubuntu 下安装 Swoole
环境:Ubuntu16.04 apt-get update apa-get install apache2 php php-pear php-dev mysql-server gcc apache2 ...
- Git安装和基本使用(1)
参考廖雪峰GIt教程 https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137 ...
- oracle PL/SQL的介绍
转自:http://blog.sina.com.cn/s/blog_4c302f060101i4o1.html 一 PL/SQL的介绍 1 PL/SQL是什么? PL/SQL(procedural l ...
- 常用jqueryPlugin
http://www.jq22.com editable-select : jQuery可编辑可下拉插件jquery.editable-select.js