Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

link with state react

// Component 1 - Link with state
<Link to="/onboarding/profile" state={{ message: "hello" }}>Next Step</Link>
// Component 2 - Get the state
import { useLocation } from 'react-router-dom'
function Profile () {
  const location = useLocation()
  const { message } = location.state // "useLocation" to get the state
  console.log(message) // Console Output: hello
  
  return (...)
}
Comment

react link state

<Link
  to='/onboarding/profile'
  state={{ from: 'occupation' }}
>
  Next Step
</Link>
Comment

PREVIOUS NEXT
Code Example
Typescript :: nodemon with ts-node not work on linux 
Typescript :: npx creat redux typescript app 
Typescript :: beautifulsoup search for elements with attributes 
Typescript :: list of continents 
Typescript :: typescript window ethereum 
Typescript :: how to declare a boolean in typescript 
Typescript :: cypress typescript tsconfig 
Typescript :: typescript valueof interface 
Typescript :: big brackets latex 
Typescript :: react native elements input phone number max characters 
Typescript :: simple firestore cloud function update document 
Typescript :: angular mailto on button click 
Typescript :: angular output send click event to parent 
Typescript :: methods defined as testmethod do not support web service callouts 
Typescript :: How to define an Tuple type in typescript 
Typescript :: class typescript constructor 
Typescript :: tepescript loop object 
Typescript :: nodejs exec exit code 
Typescript :: file_exists in wordpress 
Typescript :: react vimeo player 
Typescript :: how to fix error 429 too many requests laravel 
Typescript :: check if schema exists sql server 
Typescript :: conditional src angular 
Typescript :: firestore cloud function update documents 
Typescript :: how to validate email address in typescript 
Typescript :: pandas value_counts multiple columns 
Typescript :: generic interface typescript 
Typescript :: whats $_.FullName in powershell 
Typescript :: python get list elements missing in one list 
Typescript :: rite a script that prints “Hello, World”, followed by a new line to the standard output. 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =