I got class Component where I'm passing data:
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
class VisitDetails extends Component {
//...
render() {
//...
return() {
<div>
{/*pass to function EditVisit.js*/}
<Link to={{pathname: `/visit/edit/${id}`, state: {data}}}>Edit</Link>
<div>
}
}
}
Now I got function:
import React, { useState } from 'react';
import { useHistory } from "react-router-dom";
function EditVisit (data) {
console.log(data.info)
return(
<div>
Info: {data.info}
<div>
)
}
but data.info is no render (undefined).
EditVisita react component, or really just simply a function that is invoked somewhere? Can you update your question to include how routing works in your app and what is rendering/invokingEditVisit?