小编Jim*_*san的帖子

有没有办法在 remix 中使用 useLoaderData 重新获取?

我正在学习 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)

我想添加一个按钮来重新加载数据(因为在这种情况下我想要一个新的随机口袋妖怪)每次点击它

reactjs remix.run

8
推荐指数
2
解决办法
7756
查看次数

重定向不适用于带有 nextjs 的 netlify

我只是按照文档将其添加到我的 next.config.js 中

module.exports = {
  reactStrictMode: true,
   async redirects() {
    return [
      {
        source: "/",
        destination: "/coming-soon",
        permanent: false,
      },
    ];
  },
}
Run Code Online (Sandbox Code Playgroud)

即使我构建应用程序,它也确实可以在我的机器上运行,但在 netlify 上,由于某种原因根本没有重定向

node.js reactjs netlify next.js

1
推荐指数
1
解决办法
2487
查看次数

标签 统计

reactjs ×2

netlify ×1

next.js ×1

node.js ×1

remix.run ×1