Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

props reactjs link

// 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

PREVIOUS NEXT
Code Example
Javascript :: multiple connections to mongoose 
Javascript :: keydown event 
Javascript :: react material ui media queries 
Javascript :: component unmount useeffect 
Javascript :: hello world in jsp 
Javascript :: disable first render react 
Javascript :: jquery get selected text from multiselect 
Javascript :: vue ref add class 
Javascript :: document get element by id style 
Javascript :: how to authenticate token in react using axios 
Javascript :: nodejs express return image 
Javascript :: new line in js 
Javascript :: hide and show in angular 8 
Javascript :: javascript print out 
Javascript :: navigation reset 
Javascript :: vuejs post 
Javascript :: angular router.navigate pass data 
Javascript :: javascript phone number mask 
Javascript :: run a loop inside a console.log no blank line 
Javascript :: create a category discord.js 
Javascript :: javascript decimal to string 
Javascript :: remove white spaces 
Javascript :: javascript for loop starting from end 
Javascript :: add all elements in array javascript 
Javascript :: js get part of array 
Javascript :: javascript to help find overflow elements 
Javascript :: reset form javascript/jquery 
Javascript :: javascript select all elements 
Javascript :: follow cursor javascript 
Javascript :: remove trailing slash javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =