【发布时间】:2022-11-19 21:14:42
【问题描述】:
我正在构建一个带有 REACT 和 expressJS 服务器的数独应用程序。 我希望板子在每次刷新页面时加载上次保存的板子,这样用户就不会丢失数据。
iv managed to send a post request to the seerver and send the current board, I store the current board in an array (at the server) and i manage to update it every POST request so that everytime a change is accuring withing the board im 发送了一个post请求,效果很好,数据也被存储了。
我尝试使用“useeffect”,所以当我加载页面时,客户端将向服务器发送一个获取请求并获取最后存储的板的数组。 问题是当我加载页面时它会执行一次,但当我刷新页面时它不起作用。 (F5)。
我希望能够在每次刷新页面时发送一次获取请求。
【问题讨论】:
标签: reactjs api react-hooks server get