Babban matsalar da ke da alaฦa da shigar da React Router DOM shine cewa yana buฦatar tsari mai yawa da saiti. Yana iya zama da wahala a fahimci sassa daban-daban da yadda suke hulษa da juna. Bugu da ฦari, yana iya zama da wahala a cire duk wata matsala da ta taso yayin shigarwa. A ฦarshe, React Router DOM ba koyaushe yana dacewa da duk nau'ikan React ba, don haka yana da mahimmanci don tabbatar da cewa kuna amfani da sigar daidai kafin ฦoฦarin shigarwa.
npm install react-router-dom --save
1. npm: Wannan shine kayan aikin layin umarni don Node.js, wanda ake amfani dashi don shigar da fakiti daga ma'ajiyar Node Package Manager (NPM).
2. install: Wannan umarni yana gaya wa npm don shigar da kunshin daga ma'ajiyar NPM.
3. react-router-dom: Wannan shine sunan kunshin da za a shigar daga ma'ajiyar NPM.
4. โsave: Wannan tutar tana gaya wa npm don adana wannan fakitin azaman abin dogaro a cikin fakitin aikin ku.json fayil, ta yadda za a iya sake shigar da shi cikin sauฦi daga baya idan an buฦata.
Ajiye bangaren amsawa
Ajiye bangaren amsawa a cikin React Router siffa ce da ke ba ka damar adana yanayin bangaren React lokacin kewaya tsakanin hanyoyi daban-daban. Wannan yana da amfani don adana bayanan mai amfani, kamar abubuwan shigar da sifofi, ko duk wani bayanin jihar da ke buฦatar kiyayewa ta hanyar canje-canjen hanya. Ana iya dawo da ษangaren da aka adana lokacin da mai amfani ya koma hanya ษaya. Ana samun wannan fasalin a cikin React Router v4 kuma mafi girma.
Bambanci tsakanin npm install react router dom da npm install
NPM install react-router-dom ana amfani da shi don shigar da Laburaren React Router, wanda ke ba da damar zagayawa don aikace-aikacen React. Ya hada da abubuwa kamar ,
Ana amfani da shigarwar NPM, a gefe guda, don shigar da kowane fakiti daga rajistar NPM. Ana iya amfani da shi don shigar da fakiti kamar React Router Dom ko duk wani fakitin daga rijistar NPM.