|
|
@@ -1,5 +1,6 @@
|
|
|
import { useState } from "react";
|
|
|
import { Link } from "react-router-dom";
|
|
|
+import { useAuth } from "../hooks/useAuth";
|
|
|
const initState = [
|
|
|
{
|
|
|
id:1,
|
|
|
@@ -21,6 +22,7 @@ import { Link } from "react-router-dom";
|
|
|
},
|
|
|
]
|
|
|
function List() {
|
|
|
+ useAuth()
|
|
|
let [fruit,setFruit] = useState(initState);
|
|
|
const renderList = () => fruit.map((item,index) => <tr key={item.id}>
|
|
|
<td>{index + 1}</td>
|
|
|
@@ -37,7 +39,10 @@ function List() {
|
|
|
pathname: '/detail',
|
|
|
search:`?id=${item.id}`
|
|
|
}}>去详情</Link> */}
|
|
|
- <Link to={`/detail?id=${item.id}`}>去详情</Link>
|
|
|
+ {/* <Link to={`/detail?id=${item.id}`}>去详情</Link> */}
|
|
|
+ <Link to={{
|
|
|
+ pathname:"/detail"
|
|
|
+ }} state={{ some: "222" }} >去详情</Link>
|
|
|
</td>
|
|
|
</tr> )
|
|
|
// console.log
|