Kuv puas tuaj yeem siv cov lus tsis txaus ntseeg?
Kuv puas tuaj yeem siv cov lus tsis txaus ntseeg?

Video: Kuv puas tuaj yeem siv cov lus tsis txaus ntseeg?

Video: Kuv puas tuaj yeem siv cov lus tsis txaus ntseeg?
Video: Tsis Tau Txaus Koj | Kong Chue (Official Music Video) 2024, Hlis ntuj nqeg
Anonim

Peb ua tau pom qhov txiaj ntsig tiag siv Suspense nrog Teb . tub nkeeg rau code splitting. Cov cai pom tau tias synchronous thaum ua asynchronous, thiab peb tsis tas yuav sau ntau lub boilerplate los tswj dynamic import Promise thiab nws cov khoom siv. Teb pab neeg tseem ceeb ua haujlwm rau siv Suspense rau kev nqa cov ntaub ntawv.

Tsuas yog li ntawd, dab tsi yog qhov tsis txaus ntseeg hauv kev xav?

Teb . Xav tsis thoob hauv cov lus yooj yooj yim txhais tau tias peb tuaj yeem ncua qhov kev ua haujlwm ntawm peb cov khoom lossis cov khoom kom txog rau thaum qee qhov xwm txheej tau ntsib (piv txwv li cov ntaub ntawv los ntawm qhov kawg lossis cov peev txheej thauj khoom) thiab txog thaum ntawd qhia qhov poob rov qab (piv txwv li tus spinner)

Tsis tas li ntawd, thaum twg koj yuav tsum siv cov tshuaj PureComponent? Cheebtsam thiab PureComponent muaj ib Qhov sib txawv Thaum cov khoom siv lossis lub xeev hloov pauv, PureComponent yuav ua qhov sib piv ntiav ntawm ob qho tib si props thiab xeev. Cov khoom ntawm qhov tod tes yuav tsis piv cov khoom siv tam sim no thiab lub xeev rau tom ntej ntawm lub thawv.

Kuj nug, puas yog react suspense npaj?

Xav tsis thoob tsis yog lub tsev qiv ntawv khaws cov ntaub ntawv. Nws yog ib lub tswv yim rau cov ntaub ntawv nqa cov tsev qiv ntawv los sib txuas lus rau Teb tias cov ntaub ntawv ib feem yog nyeem tsis yog npaj tseem. Teb muaj peev xwm ces tos nws yuav npaj thiab hloov kho UI. Ntawm Facebook, peb siv Relay thiab nws cov tshiab Xav tsis thoob kev koom ua ke.

React tub nkeeg yog dab tsi?

tub nkeeg () Nws yog ib txoj haujlwm tshiab hauv teb uas cia koj thauj khoom teb Cheebtsam lazily los ntawm code splitting yam tsis muaj kev pab los ntawm lwm lub tsev qiv ntawv ntxiv. Tub nkeeg loading yog cov txheej txheem ntawm rendering tsuas-xav tau los yog tseem ceeb cov neeg siv interface cov khoom ua ntej, ces ntsiag to unrolling cov khoom tsis tseem ceeb tom qab.

Pom zoo: