:::info 持續更新中 ::: # switch case 一定要加 default 項,最好讓他 throw 個 error。 例如使用 Reducer 的時候,方便排查有沒有忘記改到 action type。 # immer 當你使用 immer 卻出 bug,可以查查: - 不要忘記 array 或 object 是複合資料型別(reference types) - 是可以直接修改他們的值的 - 是否有忘記 return # 不要熬夜寫 code 很蠢的案例,下面這個案例發生在熬夜寫 code 的過程中: ```js= let a = {name:123}; let b = a; let c = {name:789}; b = c ``` 那時候腦袋打結到以為 `b=c` 這樣會改到 `a` 的值 ...。 >a,b,c 只是個變數阿,`b=c` 只是讓 `b` 改指向 `c` 而已,那時的我到底在想什麼:_)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up