ãã®èšäºã¯ãAteam LifeDesign Advent Calendar 2022 ã«ã¬ã³ããŒ3ã®22æ¥ç®ã®èšäºã§ãïŒ
ã¯ããã«
çãããããã«ã¡ã¯ã@f0lstãšç³ããŸãïŒïŒ
ä»åã¯Reactã®ç¥èã0ã ã£ãç§ãã麻éã®ç¹æ°èšç®ãµã€ããäœã£ãã話ã§ãð€
ãšããããèŠããŠã¿ã
ãšããããã§ãæ©éã§ãããä»åéçºãããµã€ãããã¡ãððð
ãªãã§äœã£ãã®ïŒ
ããæ¥ãããªããšããããŸããã
ååð€¡ããªããªããéèè¡ã£ãŠã¿ãŸããïŒã
ç§ð€ãè¡ã£ãããšãªãïŒïŒïŒè¡ã£ãŠã¿ãŸããïŒïŒã
ðïž........ð¶ð¶ð¶ð¶
ç§ð€ãã...麻éã£ãŠã²ãŒã ã§ãããã£ãããšãªã...ç¹æ°èšç®ãããã...ã
ç§ð€ããŸãããæãã®ãµã€ãããã ããŒð¥³ã
ð€ð€³
ð€ð€³
ð€ð€³
ð€ð€³
...ð€ð€³
ç§ð€ããã£ããã«ãããµã€ããããããªãïŒïŒïŒã
â°ã...A FEW MONTHS LATER.ã
äžé·ð«¡ãæ¥æããåã¯Reactã®PJã ã
ç§ð€ãReactãã£ãããšãªããã©ã楜ããïŒå匷ããªïŒïŒã
ç§ð€ãããããããã°ã䜿ãããã麻éã®ç¹æ°èšç®ãµã€ããªãã£ããªãã
ç§ð€ãç¶æ
管çãšãåºç€åŠã¹ãŠè¯ããã...ã
ç§ð€ããã£ãïŒïŒäœããïŒïŒïŒã
ç§ð€ããããããŒð§âð»ã
ã§ãã
ãã®ãµã€ãäœã£ãŠããã¡ã«ãç¹æ°èšç®ã§ããããã«ãªã£ãããšã¯å
ç·ã§ãð€«
ã©ããªæ©èœãããã®ïŒ
â ç¹æ°èšç®æ©èœ
ããããã®ãµã€ãã§æããããã£ãæ©èœã§ãã
äœåãªè£
食ãªããã·ã³ãã«ã«ç¹æ°ãèšç®ã§ãããµã€ããç®æšã ã£ãããã
ãã®ç®æšã¯éæã§ããã®ã§ã¯...ãšæããŸãð€
䜿ãæ¹
- 芪ãåããéžæ
- ãã¢ããã³ã©ã¡ãã§äžãã£ãããéžæ
- 鳎ãããã©ãããéžæ
- äžãã£ã圹ãäžèŠ§ããéžæ
- ç¹æ°ã衚瀺ããã
芪ãšåãããããã®æ¯æãç¹æ°ã衚瀺ãããŸãð€
â¡åœ¹è§£èª¬æ©èœ
1ç¿»~ã¿ãã«åœ¹æºãŸã§ã¡ãžã£ãŒãªåœ¹ã¯ãã¹ãŠç»åã€ãã§è§£èª¬ããŠããŸãïŒ
ãŸãã鳎ãã®å¯åŠãã鳎ããå Žåäœç¿»ã«ãªãã®ããè£è¶³ããŠããŸãã
察å±äžãã®ãµã€ãããã°ã«ããã°ãç¹æ°èšç®ãã§ãããã圹ã®è§£èª¬ãèŠããã...
ãªããšçŽ æŽããããã§ãããã...ïŒïŒïŒïŒïŒ
圹ã®è§£èª¬ãšç»åäœãã®ãäžçªå€§å€ã ã£ããããããªãð€«
æåã¯å®è£ ããäºå®ã¯ãªãã£ãã®ã§ãããã圹解説æ©èœæ¬²ãããð¡ïŒããšã声ããã£ããããè¿œå ããŸããð«¡
工倫ãããã€ã³ã
工倫ãã€ã³ãâ éžã¹ã圹ã®å¶åŸ¡ð®ââïž
ãŸããéžæã§ãã圹ã®å¶åŸ¡ã§ãã
以äžãäžäŸã§ãã
ð®ââïž é³Žããå Žåã®å¶åŸ¡
鳎ããŠããªã | 鳎ãã |
---|---|
ã°ã¬ãŒã®ãã¿ã³ã¯é掻æ§ãšãªã£ãŠãããæŒãããšãã§ããªããªã£ãŠããŸãã
鳎ããŠããå Žåã¯ãç«çŽãå¹³åãäžçå£ã®åœ¹ã¯æç«ããªããããéžæã§ããŸããã
ð®ââïž ãããæ¹ã«ããå¶åŸ¡
ãã³ããã | ãã¢ããã |
---|---|
ãã³ãããã®å Žåã¯ããã¢ã嶺äžéè±ã¯æç«ããªããããéžæã§ããŸããã
éã«ããã¢ãããã®å Žåã¯ãæ²³åºæéãæ§æ§ã¯æç«ããªããããéžæã§ããŸããã
äžèšã®äŸã®ããã«åããã€ãã¢ãããã®å Žåã¯ã芪ãšåããããã®æ¯æãç¹æ°ã衚瀺ãããŸãïŒ
å€å®ã®åºæº
å€å®ãã€ã³ãã¯ä»¥äžã®3ç¹ã§ãã
- 芪ãåã
- ãã³ããã¢ã
- 鳎ãããåŠã
å圹ã«stateãæããã圹ãéžæããããã鳎ãããã©ãããªã©ã®ã¹ããŒã¿ã¹ãæŽæ°ããã床ã«ãã§ãã¯ããŠããŸãïŒ
å
±åã§ããªã圹ã®å Žåã¯stateãæŽæ°ããdisableã«å€æŽããŠããŸãïŒ
â»stateã®ç®¡çã«ã¯Recoil
ã䜿çš
工倫ãã€ã³ãâ¡ å°äžããã®è¡šç€º ð
鳎ããŠããªã | 鳎ãã |
---|---|
鳎ããŠããå Žåã圹ã«ãã£ãŠã¯2ç¿»â1ç¿»ã«å°ãäžããå ŽåããããŸãã
ãã®æ©èœãæã£ãŠãããµã€ãã¯ç§ãã¿ãéãèŠåœãããªãã£ããããå°å
¥ããŸããã
ãã¡ãããRecoilã§é³ŽãããåŠãã®stateãæã¡ã鳎ããŠããã®ã¿è¡šç€ºãããä»æ§ãšããŠããŸãïŒ
éçºã§æèãããã€ã³ã
â ã¢ã¯ã»ã·ããªãã£
ãŸãã¯ã¢ã¯ã»ã·ããªãã£ã§ãã
æ¥ããããªãããä»ãŸã§ã¢ã¯ã»ã·ããªãã£ã«çããç¥èŠãå
šããªãã£ãã®ã§ããã
ä»åãæ©ã«åŠã¶ããšãã§ããŸããð¢
â -1 ã³ã³ãã©ã¹ã
ãããã®èŠçŽ ãã¬ãã«AAãéæããæ°Žæºã§äœæããŸããã
WCAG2.1ã«ä»¥äžã®èšè¿°ããããããéžæãå¶åŸ¡ãããŠãããã¿ã³ã®ã¿ã
ã³ã³ãã©ã¹ãã®åºæºã¯éæããŠããŸããïŒ
ããã¹ãåã¯æåç»åã«ãããŠã次ã®å Žåã¯ã³ã³ãã©ã¹ãã®èŠä»¶ã¯ãªããã¢ã¯ãã£ãã§ã¯ãªããŠãŒã¶ã€ã³ã¿ãã§ãŒã¹ ã³ã³ããŒãã³ãã®äžéšã§ãã
éæåºæº 1.4.3 ã³ã³ãã©ã¹ã (æäœé)
â -2 ã¿ãŒã²ããã®ãµã€ãº
ãããã®èŠçŽ ã44x44pxãè¶
ãããµã€ãºã§äœæããã¬ãã«AAAãéæããŠããŸãã
ãã¡ãããWCAG2.1ã«ä»¥äžã®èšè¿°ããããããããã«æºæ ãã圢ã§ãã
ãã€ã³ã¿å ¥åã®ã¿ãŒã²ããã®ãµã€ãºã 44 à 44 CSS ãã¯ã»ã«ä»¥äžã§ããããã ãã以äžã®å Žåã¯äŸå€ãšããã
- åçã®ãã®ãååšãã: ãã®ã¿ãŒã²ãããšåçã®ãªã³ã¯åã¯ã³ã³ãããŒã«ãåãããŒãžã« 44 à 44 CSS ãã¯ã»ã«ä»¥äžã®ãµã€ãºã§ååšããã
- ã€ã³ã©ã€ã³ã§ãã: ãã®ã¿ãŒã²ãããæäžãåã¯ããã¹ããããã¯å ã«ååšããã
éæåºæº 2.5.5 ã¿ãŒã²ããã®ãµã€ãº
â¡ ãã¶ã€ã³ã·ã¹ãã
ä»åäœæãããããã麻éç¹æ°èšç®ã§ã¯ãShopifyã®ãã¶ã€ã³ã·ã¹ãã ãåèã«ãããŠããã ããŸããã
ç§ã¯ä»ãŸã§ãã¶ã€ã³ããã£ãããšããªãããã¶ã€ããŒãäœã£ãã«ã³ããçµã¿èŸŒãã®ã¿ã§ãã...ð¢
ä»åããã¶ã€ã³ã·ã¹ãã ã®éèŠæ§ãåŠã¹ãããšã¯ãéçºäººçã«ãããŠéåžžã«è¯ãåŠã³ã«ãªããŸããð¢ïŒ
䜿çšæè¡
- React
- Next.js
- Tailwind CSS
- Netlify
èŠåŽãããã€ã³ã
èŠåŽãããã€ã³ããªãã§ãããæ¬åœã«å
šéšã§ããç¬
å§åçã«ã¹ãã«ã足ããªããããã®ã§ããšãŠãèŠåŽããã®ã§ããã
ãã®äžããããã¯ã¢ããããŠã話ãããŸãïŒ
â ããããReactãããã£ã
ä»åããã®éçºã§ã»ãŒåããŠReactãæ±ã£ãã®ã§ãæåã¯èŠåŽããŸãã...
ãã«ã¹ã¿ã hookãããããããŒãããã³ã³ããŒãã³ãã©ããã£ãŠåãã°ããã®ãŒããšã
ãšãŠãé ãæ©ãŸããŸããã
ã§ãããUdemyèŠãŠãéçºããŠãUdemyèŠãŠ...ãšç¹°ãè¿ããã¡ã«ãã ãã ããããããšãå¢ããŠããŠã
å§åçã«ã§ããããšãå¢ããŠããŸãã...ð¢
å¬ãã...ð¢
ã§ãããããã©ãŒãã³ã¹é¢ã§ã¯ãŸã ãŸã åãããªãããšãå€ãã®ã§ã
useCallbak
ãuseMemo
ãããããå®å
šã«ç解ããããšèšããããåªåããŸãð
â¡ Recoilã§ã®ç¶æ 管ç
Recoilãä»ååããŠäœ¿ã£ãã®ã§ããã
åãã¯æŠå¿µãç解ããã®ã«ãšãŠãæéãããããŸãã...
ãatomã£ãŠãªã«ð¥³ïŒããSelectorã£ãŠãŒð¥³ïŒãç¶æ ã§ãã...ã
æ¹ããŠèãããšç¶æ
管çãå¿
èŠãªãã®ã¯ãæ°åãããªãã®ã§ããããŸã§è€éã§ã¯ãªãã£ãã®ãã...ð€ïŒ
ä»ã§ã¯ãããããã®JSåã匱ãã£ãã®ããªããšæã£ãŠããŸãã
ãããªäžã§è²ã
åãåããªããå®è£
ãããªããšãå®çŸã§ãããã®ã®ã
æ£çŽãçŸç¶ã®å®è£
ããã¹ããªã®ãããã£ãŠããŸããïŒç¬
絶察ãã¹ãã§ã¯ãªãã§ãããïŒç¬
ã§ãããããã¯ä»åŸã®äŒžã³ããã®ããã§ãïŒïŒïŒ
è¿ãå°æ¥ãããããæ匷ããŒð€ãã£ãŠç¶æ
ã«ããŠã¿ãŸãïŒïŒ
ãŸãšã
ããŠããŸãšãã§ãã
ãã¡ããã¡ãåœããåãªã®ã§ãããæ¬åœã«ãã£ãŠããã£ããšå¿ããæããŸãð€
ãã®ãµã€ãå¶äœãããåããã£ãåŸãæ¯èŒããŠã¿ããšå€ãã®ããšãã§ããããã«ãªã£ããªããšæããŸãã
ð» ã¹ãã«é¢ ð»
- ð
React, Next.jsã®ç¥èã0ã§åŠãŒããšãæã£ãŠããªãã£ã
- ð Reactã®åºç€ãããããã®ã«ã¹ã¿ã hookã®ç¥èã身ã«ä»ãããã
- ð Next.jsã®åºç€ãã³ã³ããŒãã³ããªã©ã®ç¥èã身ã«ä»ãããã
- ð
ãã¹ãã£ã³ã°ãµãŒãã¹ã£ãŠãªã«ïŒã ã£ã
- ð Vercelã®ãããã€ãç¥ãããšãã§ãã
- ð è«žã 調ã¹ãŠãæçµNetlifyãéžå®ãããããã€ã§ãã
- ð
èšæž¬ç³»ããŒã«ã®å°å
¥ããããªãã£ã
- ð 以äžãããŒã«ãèªåã§å°å
¥ã§ãã
- GA
- GTM
- SearchConsole
- ð 以äžãããŒã«ãèªåã§å°å
¥ã§ãã
- ð
ãã¶ã€ã³ãã¯ã¿ã·ãã¯ã«ãªãã»ã³...
- ð ã¢ã¯ã»ã·ããªãã£ããã¶ã€ã³ã·ã¹ãã ã®ç¥èŠãåŸããã
ð« ã¡ã³ã¿ã«é¢ ð«
- ð
çµæ¥åŸã¯YouTubeã°ããèŠãŠãã
- ð çµæ¥åŸã«
ã»ãŒæ¯æ¥éçºãè¡ããåŠã¶ç¿æ £ã身ã«ä»ãããã
- ð çµæ¥åŸã«
- ð
ç¥èããªããããšãåŠã¶ããšããéããŠãã
- ð ããããªããªãã«ãã培åºçã«èª¿ã¹ãã°èªåã®åã§ãªããšããªããšç¥ã£ã
- ð äœäºãæãã°ãªããšç¥ã£ã âããæ¬åœã«å€§äº
- ð
èªåã²ãšãã§äœããäœãäžããããšããªãã£ã
- ð ãµã€ããã²ãšã€ãäœãäžããããšã§æåäœéšãã§ãã
ãšããã£ãããããŠãããšã£ãŠãå€ãåŠã³ããããŸããïŒ
ãšã¯èšãããŸã ãŸã 䌞ã°ããã¹ãã«ã¯å±±ç©ã§ãããå®åããŸã ãŸã ã§ãã
ä»åŸãã¹ãã«ã¢ããéããŠãããããã³ããšã³ãžãã¢ãšèªä¿¡ãæã£ãŠèšããããã«ããŸãð€ð€ð€
æåŸã«
ãããããã¢ããã³ãã«ã¬ã³ããŒã倧詰ãã§ãïŒ
ä»åŸãã©ããªèšäºãäžããã®ããšãŠã楜ãã¿ã§ããðºðºðº
ç§ããŠããŠãããŠåŸ
ã¡ãããšæããŸãð€
æåŸãŸã§èŠãŠããã ããããããšãããããŸãããŒïŒ