Cov txheej txheem:

Dab tsi yog navigation hauv react haiv neeg?
Dab tsi yog navigation hauv react haiv neeg?

Video: Dab tsi yog navigation hauv react haiv neeg?

Video: Dab tsi yog navigation hauv react haiv neeg?
Video: BABY I WANNA MEET YOU - NT ONE [OFFICIAL MUSIC VIDEO] | HMONG NEW SONG - NEW SONG 2023 2024, Hlis ntuj nqeg
Anonim

Thaum tsim cov apps mobile, qhov kev txhawj xeeb tseem ceeb yog peb ua li cas rau tus neeg siv kev taw qhia los ntawm lub app - kev nthuav qhia ntawm cov ntxaij vab tshaus thiab kev hloov ntawm lawv. React Navigation yog ib lub tsev qiv ntawv standalone uas tso cai rau tus tsim tawm los siv cov haujlwm no yooj yim.

Kuj nug, yuav ua li cas kuv ntxiv navigation hauv react haiv neeg?

  1. Kauj ruam 1: Nruab React Native. Okay, tam sim no nruab qhov react native project los ntawm cov lus txib hauv qab no.
  2. Kauj ruam 2: Tsim ob lub vijtsam rau peb qhov project.
  3. Kauj ruam 3: Nruab lub React Navigation pob.
  4. Kauj ruam 4: Ntxiv cov Navigation Button hauv Chaw.
  5. Kauj ruam 5: Reload daim ntawv thov.

Tsis tas li ntawd, koj yuav ua li cas taug kev los ntawm ib qho screen mus rau lwm qhov screen hauv cov neeg nyob hauv teb chaws? Tsiv ntawm ib qho screen rau lwm qhov yog ua los ntawm kev siv lub kev taw qhia prop, uas dhau los ntawm peb npo cov khoom.

Nkag mus rau qhov screen tshiab

  1. < khawm.
  2. title="Mus rau URL"
  3. onPress={() => qhov no. khoom siv. kev taw qhia. navigate('url')}
  4. />

Kuj Paub, Kuv yuav siv lub router li cas hauv cov neeg ua teb?

React Native - Router

  1. Kauj ruam 1: Nruab Router. Yuav pib nrog, peb yuav tsum nruab lub Router.
  2. Kauj ruam 2: Daim ntawv thov tag nrho. Txij li thaum peb xav kom peb lub router tswj tag nrho daim ntawv thov, peb yuav ntxiv nws hauv qhov ntsuas.
  3. Kauj ruam 3: Ntxiv Router. Tam sim no peb yuav tsim cov Routes tivthaiv nyob rau hauv lub Cheebtsam folders.
  4. Kauj ruam 4: Tsim cov Cheebtsam.

React router yog dab tsi?

React Router yog tus qauv txoj kev qiv rau Teb . Los ntawm cov ntaub ntawv: React Router khaws koj UI sync nrog URL. Nws muaj qhov yooj yim API nrog cov yam ntxwv muaj zog xws li tub nkeeg code loading, dynamic txoj kev sib piv, thiab qhov chaw hloov pauv tau tsim nyob rau hauv.

Pom zoo: