我有这条路线钱包/[货币]。我可以打电话给钱包的信息,在钱包路线上,用这个
*index.tsx*
import React, { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { getAccountData } from '../../redux/actions/account.action';
export default function index() {
const dispatch = useDispatch();
useEffect(() => {
dispatch(getAccountData({ accountId: 1, userId: 1 }));
}, []);
return (
<div>
<h1>Wallet page</h1>
</div>
);
}
它运行良好,但是当我尝试在钱包/[货币] 上做同样的事情时,我变得不确定
*[currency].tsx*
import React, { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { getAccountData } from '../../redux/actions/account.action';
export default function Moneda() {
const dispatch = useDispatch();
const pepe: Function = async () => {
try {
await dispatch(getAccountData({ accountId: 1, userId: 1 }));
} catch (error) {
console.log(error);
}
};
useEffect(() => {
pepe();
}, []);
return (
<div>
<h1>moneda</h1>
</div>
);
}
我缺少什么?