将数据传递到另一页:
,我可以在console
const handleRowClick = (rowData, rowMeta) => {
navigate("/history", rowData[0]);
console.log(rowData[0], "products");
};
const options = {
filter: true,
selectableRows: "none",
responsive: "simple",
onRowClick: handleRowClick,
};
在
state
中什么都没有
const History = (props) => {
const { state } = useLocation(); //document ID here
console.log(state, "state");
return (
<div>
</div>
);
};
export default History;
<Route
path="/history"
element={
<PrivateRoute>
<Layout>
<History />
</Layout>
</PrivateRoute>
}
/>
我不知道这里有什么问题
edit-page
和
edit
键的“ torge和一个“选项”对象。usenavigate
navigate
将state
数组元素移到replace
键下的选项对象中。 示例:
declare function useNavigate(): NavigateFunction;
interface NavigateFunction {
(
to: To,
options?: { replace?: boolean; state?: any } // <-- options object, state
): void;
(delta: number): void;
}
挂钩访问路线状态。使用接收组件上的rowData
state