[英]axios POST on React dosen't work with backend MYSQL (but works on postman)
[英]Searchbox dosen't work when the input is erased react redux
我正在練習反應 redux 並且我正在制作一個簡單的 CRUD。 我創建了一個搜索框輸入,並且工作正常,但是當我刪除輸入時,帶有數據的表不會更新。 我已經嘗試將結果保存到初始狀態的“搜索”中,但仍然無法正常工作。 我做錯了什么? 謝謝!
我在這里上傳我的代碼:
https://codesandbox.io/s/silly-wood-5ni19?fontsize=14&hidenavigation=1&theme=dark
嘗試更改為:
case "SEARCH_DATA": {
const { event } = action.payload;
let res = [];
if (event) {
res = state.data.filter( el => el.name.toLowerCase().includes(event));
}
return {
...state,
data : res, // here is pass the result of the filter fn
loading: true
};
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.