eGroupTeam / course-frontend

0 stars 2 forks source link

useState的替代方案? #17

Open ryanbohongcho opened 1 year ago

ryanbohongcho commented 1 year ago

是否可以使用session值來取代usestate 的效果?例如:每按一次按鈕就更新一次session值。

jitsungwu commented 1 year ago

如果是跨頁可使用context或redux,但是,在頁面中,useState的更動才能觸發rerender

ryanbohongcho commented 1 year ago

session這個功能並不能直接的取代useState,useState的功用主要是透過檢查元素是否改變來rerender該元素,而不會重新載入整個頁面。