我正在学习 remix,我的加载器中有一些函数,我可以使用 useLoaderData 在默认路由中调用它们,如下所示:
export const loader = async () => {
const pokemon = await getRandomPokemon();
const types = await getAllPokemonTypes();
return [pokemon, types.results];
};
export default function App() {
const [pokemon, types] = useLoaderData();
...
}
Run Code Online (Sandbox Code Playgroud)
我想添加一个按钮来重新加载数据(因为在这种情况下我想要一个新的随机口袋妖怪)每次点击它
我只是按照文档将其添加到我的 next.config.js 中
module.exports = {
reactStrictMode: true,
async redirects() {
return [
{
source: "/",
destination: "/coming-soon",
permanent: false,
},
];
},
}
Run Code Online (Sandbox Code Playgroud)
即使我构建应用程序,它也确实可以在我的机器上运行,但在 netlify 上,由于某种原因根本没有重定向