Cov txheej txheem:

Yog vim li cas react sai?
Yog vim li cas react sai?

Video: Yog vim li cas react sai?

Video: Yog vim li cas react sai?
Video: Hmong New Song 2019 Xy Lee feat. SuabNag Yaj - Koj Yog Kuv Lub Neej (Official MV - 4K) 2024, Kaum ib hlis
Anonim

Vim tias ReactJS pab tiv thaiv kev hloov kho ntawm DOM, nws txhais tau tias cov apps yuav yog sai dua thiab xa UX zoo dua. ReactJS tau tsim los pab txhim kho tag nrho cov nplooj ntawv ua tiav los ntawm lub vev xaib server. Tsis tas li ntawd, nws siv cov nodes los ua rau ntawm tus neeg siv khoom.

Ib yam li ntawd, vim li cas thiaj li cuam tshuam virtual Dom sai dua?

Teb yog ceev vim nws tsuas manipulates lub DOM ntau npaum li nws xav tau. Hloov kho cov kev hloov pauv ntau heev sai dua dua li rov tsim kho tag nrho DOM tsob ntoo los ntawm khawb. Nws muaj peev xwm ua tau qhov no vim nws khaws cov virtual DOM sawv cev los ntawm lub sij hawm dhau los peb hloov kho lossis muab peb cov khoom hauv nco.

Ib yam li ntawd, vim li cas thiaj zoo dua? Nov yog ob peb lub laj thawj vim li cas React tau dhau los ua neeg nyiam sai heev: Ua haujlwm nrog DOM API nyuaj. Teb hauv paus muab cov neeg tsim khoom muaj peev xwm ua haujlwm nrog lub browser virtual uas yog tus phooj ywg ntau dua li qhov browser tiag. React cov virtual browser ua zoo li tus neeg sawv cev ntawm tus tsim tawm thiab tus browser tiag.

Tsis tas li ntawd, vim li cas cov tshuaj tiv thaiv sai dua angular?

App loj thiab kev ua haujlwm - Angular muaj qhov zoo me ntsis Vim yog virtual DOM, ReactJS apps ua sai dua AngularJS apps ntawm tib qhov loj me. Tsis tas li ntawd, Angular muaj qhov me me app loj dua piv rau Teb nrog Redux hauv tib txoj kev tshawb fawb: Nws hloov pauv loj yog 129 KB, thaum Teb + Redux yog 193 KB.

Kuv yuav ua li cas thiaj li ua rau kuv lub app react sai?

21 Kev Ua Haujlwm Zoo Tshaj Plaws rau React Apps

  1. Siv Immutable Data Structures.
  2. Function/Stateless Cheebtsam thiab React.
  3. Ntau cov ntaub ntawv chunk.
  4. Siv React.
  5. Tsis txhob Inline Function txhais hauv Render Function.
  6. Throttling thiab Debouncing Event Action hauv JavaScript.
  7. Tsis txhob siv Index li Key rau daim ntawv qhia.
  8. Zam Kev Tiv Thaiv Cov Khoom Siv Hauv Lub Xeev.

Pom zoo: