Web dev 討論區

ぱないの

1001 回覆
149 Like 24 Dislike
無奶油俾人用 2024-02-25 15:27:37
其實新版既react doc 講得幾好
天蠍座 2024-02-25 16:42:06
諗起之前vue作者evan you 屌人話react doc寫得好

ぱないの 2024-02-25 18:19:57
rerender=/=dom change
當你用 value={{...}} 嘅時候,每個render都整個新object出黎,而每個consumer都會rerender
但同時 children prop係pass入黎嘅prop, 會唔會rerender係取決於parent, 唔係取決於個provider

所以通常都會將context value destructure左先用,以免擺落useeffect會trigger多左
無奶油俾人用 2024-02-25 18:32:30
我都可以理解Eva. You 點解咁講 Vue3 同react hooks 兩個我都有用,的確Vue3 個心智負擔係低過React
れんげ 2024-02-25 19:17:43
有冇人覺得react條team諗野同正常人諗野好唔一樣
我愛馬斯亞 2024-02-25 20:45:18
想問下redux唔係就係為左解決2個問題咩
ぱないの 2024-02-25 21:06:22
https://blog.isquaredsoftware.com/2021/01/context-redux-differences/#choosing-the-right-tool

Redux maintainer嘅解釋:


Recommendations 🔗︎
So, how do you decide whether to use Context, Context + useReducer, or Redux + React-Redux?

You need to determine which of these tools best matches the set of problems that you're trying to solve!

If the only thing you need to do is avoid prop-drilling, then use Context
If you've got some moderately complex React component state, or just really don't want to use an external library, go with Context + useReducer
If you want better traceability of the changes to your state over time, need to ensure that only specific components re-render when the state changes, need more powerful capabilities for managing side effects, or have other similar problems, use Redux + React-Redux
My personal opinion is that if you get past 2-3 state-related contexts in an application, you're re-inventing a weaker version of React-Redux and should just switch to using Redux.
rh0x0 2024-02-25 21:30:53
如果諗嘢同正常人一樣
當年又未必會反其道而行整到react出嚟
れんげ 2024-02-25 21:46:57
問過angular 1未
無奶油俾人用 2024-02-25 22:07:57
其實我都明白react 就係一改左state 既data ,個developer 就自己控制幾時re-render, re-render 個陣出現performance issue, 咁樣就用useMemo 等等既hook 去俾developer 自己調教番,少d 黑魔法

以前我都幾中意呢種直來直往、將決定交番俾developer 既諗法, 但後來就慢慢改左,慢慢覺得呢樣調下個度較下,就覺得與其要擔心呢樣擔心個樣,咁其實reactive 裡面幫我做哂所有野,俾我無腦可以focus on business logic 咁就好了

所以就慢慢偏向番Vue, 但唔代表react 唔好用,始終個community , library 都真係react多d,有d位可能用番react會幾好用
ぱないの 2024-02-25 22:27:31
一切都有前因後果嘅,react 當初嘅model係every component is a class/function, return出黎就係個dom, nothing more.

有左呢個咁未完善嘅model先會激發到其他framework, 例如vue/solidjs/svelte

你講得好岩嘅係用react係用個community,同埋工作需要。我而家小型網站freelance全部轉用svelte, 工作速度真係快好多。但另一方面react native (expo)係未來5年一撚定仲係主流,如果有人同我爭論用capacitor/ionic會好d,我一定跳出黎做反駁隊隊長capacitor簡直係地獄DX
馬拉申科上尉 2024-02-26 06:51:25
Angular 改善左好多了
雖然都係最閪煩既framework
好奶凍 2024-02-26 09:05:31
新project 用vue, junior 上手快好多,code review 又輕鬆,又唔洗太多無謂internal doc 去解釋technical decision details.
好奶凍 2024-02-26 09:30:23
無計 react 係選錯左個abstraction level 黎做,low level 又唔夠直接,high level 又唔夠方便。最後搞到patch 黎patch 去 四不像。

有人話鐘意用react 因為比developer full control, 但我想講呢樣係錯覺黎,佢淨係比左我地去control d 無關痛癢嘅事,原地瘋狂reinvent the wheel. E 加連life cycle 都混亂埋… 真係要full control 就用jQuery 啦
好呀好呀好呀好呀 2024-02-26 09:37:48
nextjs ts jotai
隨圖附送大JJ 2024-02-26 09:39:41
想轉行,web dev同software dev係咪一樣野
有啲唔知點起步,自己想focus python,但又唔知咩方面發展
而家做果行學python會有幫助,所以想由python發展開去做,但預見未來會俾ai cut大量job所以想準備定,一兩年內轉由junior做起
就到30求指點
素晴 2024-02-26 10:05:47
諗你想寫code整啲乜product/做啲乜task先
之後先決定language
爆裂火喉 2024-02-26 10:59:17
寫緊個web app想比人可以upload相分享野
仲諗緊應該點做
用緊mongoDB做database 用base64好唔好
或然率 2024-02-26 11:04:32
先留名再討論
天蠍座 2024-02-26 11:20:54
圖轉base64會變大好多
MongoDB可以直接store blob data
無奶油俾人用 2024-02-26 11:29:49
我都認為你講得岩,唔係針對緊話React 既諗法唔好,上面都有巴打講到有左react 然後刺激到唔同framework 出黎,然後react 都係早過哂咁多個frontend framework 出現,投入開發既人數多同埋community 人數多

加埋react 對用熟左既人黎講無明顯唔好處到要用另一款framework 取代佢,咁好自然就會stay 番起confront zone,將佢地過往寫左既code 經驗累積到下一份PJ到,做又做快左,愈寫愈知有咩伏位,就更加貢獻番起React入面

不過都有好似我咁,react 用熟左就愈來愈發現到太過要求developer 要好細心咁處理state, re-render, teammate 起唔熟悉react 只係學左片面既知識,係唔足夠令到自己放心寫出黎既野係無問題,好容易會因為經驗唔夠而寫到performance 差既code 出黎

咁所以先慢慢去搵一d reactive 黑魔法等個framework 自動波處理哂呢d野,但真係唔係react 問題,只係佢個理念係要睇下自己teammate 本身對react / JS熟唔熟,有無中過伏,中唔中意所有野都自己處理,community 夠大容易搵到解決方法,否則既話,都係建議搵d唔洗煩咁多野,做完business logic 就完事,reactive 既framework

當然都係可以寫react 得黎又去用reactive 啦 例如mobx 個類咁,但又無左react 個種full control 理念
れんげ 2024-02-26 11:37:09
講最早應該係angular ,1 ember個堆, 然後react出現自稱唔係framework
爆裂火喉 2024-02-26 12:06:07
Thanks ching
睇吓咩係blob先
有時覺得好多野都無從入手
google search 點save image 發覺都無咩網可以好詳細解釋每樣野
例如其中一個方法係用GridFS 但係又無好既doc 解釋同點implement
ぱないの 2024-02-26 12:53:42
react 而家對IT行業黎講最大問題係太易上手,太難專精
太容易寫爛code但對user問題不大,久而久之就出左一班專寫爛code嘅印度佬大陸佬同bootcamper,又唔肯學深入d

我早排做freelance個client請左個大陸佬整CMS,已經唔係junior但到處都是怪氣味,每個PR都要我比十個八個change request, 今個月就走左
咕狗 2024-02-26 12:53:51
點L解要storage image raw data in DB? 正正經經s3啦
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞