Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

Link in react

import {Link} from 'react-router-dom'
<Link to="/">Home</Link>
<Link to="about">About</Link>
Comment

link react

//Go to link and refresh the page
<a onClick={() => {window.location.href="/something"}}>Something</a>
Comment

link tag react

<Link to={`/users/${user.id}`} activeClassName="active">{user.name}</Link>
// becomes one of these depending on your History and if the route is
// active
<a href="/users/123" class="active">Michael</a>
<a href="#/users/123">Michael</a>

// change the activeClassName
<Link to={`/users/${user.id}`} activeClassName="current">{user.name}</Link>

// change style when link is active
<Link to="/users" style={{color: 'white'}} activeStyle={{color: 'red'}}>Users</Link>
Comment

PREVIOUS NEXT
Code Example
Typescript :: find value in array ts 
Typescript :: download and run exploits from exploit-db 
Typescript :: python requests post set content type 
Typescript :: how to use command line arguments in java eclipse 
Typescript :: typescript string to enum 
Typescript :: ionic 4 set root page when logout 
Typescript :: match a string that starts and ends with the same vowel 
Typescript :: reactive form disable 
Typescript :: array of objects how to check if property has duplicate 
Typescript :: reactnative typescript 
Typescript :: node typescript 
Typescript :: iterate object ngfor 
Typescript :: mongoose removed empty objects 
Typescript :: html dom typescript 
Typescript :: function that redirects to another page react 
Typescript :: ionic email validation 
Typescript :: typescript enum to array 
Typescript :: check if list of objects contains value c# 
Typescript :: iframe redirects to another page 
Typescript :: duplicate names in sql 
Typescript :: delete contents of folder java 
Typescript :: where are screenshots stored steam 
Typescript :: install snowpack 
Typescript :: To list all tcp ports. 
Typescript :: typescript array of objects interface 
Typescript :: angular jasmin mock http response 
Typescript :: ionic scroll to item programmatically 
Typescript :: what namespace are lists 
Typescript :: group elements in list with some attributes 
Typescript :: empty object typescript 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =