ç§ã®èšäºã§ã¯ãæ°ããAngularããšã³ã¿ãŒãã©ã€ãºã¢ããªã±ãŒã·ã§ã³ã®åºç€ãšããŠäœ¿çšããçµéšãçãããšå
±æããããšæããŸãã æ°ããAngularã¯ReactãVueããŸãã¯ä»ã®äººæ°ã®ããã©ã€ãã©ãªãããåªããŠãããšããã¹ããŒãã¯ããã®èšäºã«ã¯å«ãŸããŸãããããã¡ããã競åä»ç€Ÿãšæ¯èŒããŸãã ãã¹ãŠã®ãœãªã¥ãŒã·ã§ã³ã«ã¯é·æãšçæãããããããããžã§ã¯ãã«é©ããŠãããã®ã¯ãå¥ã®ãããžã§ã¯ãã§æŽ»æ°ã¥ãããšãã§ããŸãã ãã®ãããæ°ããAngularãç§ãã¡ãåŒãä»ãããã®ã説æããåã«ãéçºã§ãã§ã«äœ¿çšããŠãããã®ã«ã€ããŠå°ãã話ãããŸãã
ç§ãã¡ã®äž»ãªãããžã§ã¯ãã¯é·ãéçºãã¹ãæã¡ããã§ã«æ代é ãã®ãã¯ãããžãŒã§ããããªãªããã+ããã¯ããŒã³+ã³ãã£ã¹ã¯ãªããã§æ§ç¯ãããŠããŸãã æ°å¹Žåãç§ãã¡ã¯ãã®ãããªã¹ã¿ãã¯ã§ãããžã§ã¯ããéçºããããšãéåžžã«å°é£ã«ãªã£ãããšã«æ°ä»ããããã³ããšã³ããšã³ã·ã¹ãã ã§ä»£æ¿æ¡ãç 究ããããã§ãç£ããã©ã®ããã«ç§»è¡ã§ããããèãå§ããŸããã
ãããžã§ã¯ãã®äœæ¥ãéå§ããŠãçŸåšäººæ°ã®ããReact + Redux +ã¹ã¿ãã¯[ReselectãRedux-SagaãRedux-formãªã©]ãéžæããŸããã ããã¯ãæ°ããã¹ã¿ãã¯ãéžæããæåã®è©Šã¿ã§ãããæ®å¿µãªãã倱æããŸãããäœå¹Žãåã«ããªãªãããã»ã©äŸ¿å©ã§ã¯ãªãã£ãããã§ãã çŽ6ãæåã®èª¿æ»ã®çµæãç§ãã¡ã®éžæã¯æ°ããAngularã«èœã¡ãç§ãã¡ã¯ããã«æºè¶³ããŠããŸãã æ°ããAngularã¯äŒç€Ÿã®ã¡ã€ã³ãããžã§ã¯ãã§ã¯äœ¿çšãããŠããŸããããå°æ¥çã«ã¯ãã®ãœãªã¥ãŒã·ã§ã³ãžã®ç§»è¡ã«æ¯éã¯ãããŸããïŒCoffeescriptã®å·šå€§ãªã³ãŒãããŒã¹ã«æ¢ããããªãéãïŒã ããã§ãæ°ããAngularã§èŠã€ãããã®ãšããã奜ãã ã£ãæ¹æ³ãèŠãŠã¿ãŸãããã
éèŠåºŠã§ã¯ãªãããã€ã³ããã©ã³ãã ã«è¡šç€ºãããŸãã ãã¡ããããœãªã¥ãŒã·ã§ã³ã®å©ç¹ãèæ ®ãããã®ããå§ããæåŸã«æ¬ ç¹ã«ã€ããŠã話ããŸãã
é·æ
è§åºŠã¯ãã¬ãŒã ã¯ãŒã¯ã§ã
ããã¯ç§ãã¡ã«ãšã£ãŠæãéèŠãªå©ç¹ã®1ã€ã§ãã 5幎åã«äŒç€Ÿã§ãããžã§ã¯ããå§ãããšããã¯ãŒã«ã§å šäœçãªè£œåãæ§ç¯ããã®ã¯ç°¡åã ãšæããŸããã ãªããŠçŽ æŽãªãã ïŒ :)ããå€ãã®äººã ããããžã§ã¯ãã«æ¥ç¶ããã»ã©ãäžè¬çãªã¹ã¿ã€ã«ãšã¢ãŒããã¯ãã£ã«ãœãªã¥ãŒã·ã§ã³ã®ãåç©åãå šäœãæã¡èŸŒãã®ã«ããå€ãã®æéãè²»ãããŸããã ããã¯ãMarionetteãéçºè ãå¶éããããšã®ãªãããªããã£ãã®ã»ããã«ãããªããããMarionetteãç§ãã¡ã«äžããèªç±ã®ããã§ãã
ãã¹ãŠã®äººã¯ç°ãªã£ãŠããã誰ãã奜ããªããã«è£œåã®ã³ãŒããäœæããŸãã ãã®åé¡ã«èŠåŽããŠããªããšããã«ãã³ãŒãã£ã³ã°ã¹ã¿ã€ã«ãå°å ¥ããã³ãŒããä¿®æ£ããã¢ãŒããã¯ãã£ã®èª¬æãäœæããŸããããååã®1人ããéæšæºã®ãœãªã¥ãŒã·ã§ã³ã«åºãããããšãããããããžã§ã¯ããåãéçºãšã¢ãŒããã¯ãã£ã«æ»ãããã«å€å€§ãªåŽåãè²»ããå¿ èŠããããŸããã
ãã®åŸãReactã®éçºæéããããReduxãšFluxãç§ã®å©ãã«ãªã£ãããã§ãã ã¯ããããã«ããããããã®ã¢ãã«ã®å€æŽãã³ãŒãå šäœã«æ£åšããããšãå¿é ããå¿ èŠããªããªããŸããããåé¡ã®1ã€ã¯ãŸã æ®ã£ãŠããŸããã ç§ã¯ã補åã«åŒããã蟌ãŸããã©ã€ãã©ãªãŒã®ã»ããå šäœãè¿œããªããã°ãªããŸããã§ããã ç§ãã¡ã®ã¹ã¿ãã¯ã¯ããã®å€æ§æ§ãšã¢ãããŒãã«æºã¡ãŠããŸããã
次ã«ãAngularã«åãæ¿ããŸããã ãã®æè»æ§ã«ãããããããéçºè ã«ãšã£ãŠã¯ããªãå¶éçãªãã¬ãŒã ã¯ãŒã¯ã§ãã ãŸããéåžžã«å€ãã®å¯èœæ§ãå«ãŸããŠããããããããžã§ã¯ãã«æ°ããã©ã€ãã©ãªãå°å ¥ããããšã¯ç§ãã¡ã«ãšã£ãŠéåžžã«ãŸããªã€ãã³ãã«ãªããå¶åŸ¡ã容æã«ãªããŸããã AngularããŒã ãæäŸããã³ãŒãã£ã³ã°æšæºã®ååšã«ãããç§ã¯å®å šã«æ¯ãåãããªã©ãã¯ã¹ããéçºã«ããå€ãã®æéãå²ãããšãã§ããŸããã
ãã¡ãããAngularã§ã¯ã«ãªã¹ãäœæã§ããŸãããããã©ãŒãã³ã¹ãè©äŸ¡ãããšãããŸãã¯åå©çšããããšãããšã誀ã£ãŠæ§ç¯ãããã³ãŒããããã«è¡šç€ºããããããããã¯éåžžã«å°é£ã§ãã ããå³ãããã¬ãŒã ã¯ãŒã¯ãçšæã§ãããããããã®ã§ãããæ®å¿µãªãããæ¡åŒµããå¯èœæ§ã¯å€±ãããŸãããããããããŸããã ç§ã«ã¯ãAngularã§åŠ¥åç¹ãèŠã€ãã£ãããã§ã-ããã¯ãã¹ãŠã®ããªãªããããèš±å¯ããŠããããã§ã¯ãããŸããããé£ããExtjsã¯èš±å¯ããŠããŸããã
CLIã·ã¹ãã ã®å¯çšæ§
ãã¡ãããããã¯è§åºŠã®ãã©ãŒæ©èœãšã¯ã»ã©é ããReactã«ãç¬èªã®cliïŒreact-starter-kitïŒããããŸãããããã«ããããããããã€ã©ãŒãã¬ãŒããéžæããã®ã«æéãè²»ããããããã³ã³ãœãŒã«ã¯ã©ã€ã¢ã³ãã䜿çšããŠæ°ãããœãªã¥ãŒã·ã§ã³ã®ç 究ãéå§ããæ¹ãã¯ããã«ç°¡åã§ãäœããæ©èœããªãçç±ãèŠã€ããã ããã«ãã³ã³ãœãŒã«ã¯ã©ã€ã¢ã³ãã«ã¯ãæå°éã®ã¢ããªã±ãŒã·ã§ã³ãã³ãã¬ãŒããããã«çæããéçºã¢ãŒããŸãã¯éçšã¢ãŒãã§ã³ãŒããç°¡åã«å®è¡ãããã¹ããå®è¡ã§ãããšãã倧ããªå©ç¹ããããŸãã
ãã¡ãããããã¯ãã¹ãŠãšã³ããªã®ãããå€ãäžãããã¡ã€ã«ã®å Žæãã¢ããªã±ãŒã·ã§ã³ã®ãã¹ã±ã«ãã³ãã®èšè¿°ã«ã€ããŠïŒããçšåºŠãŸã§ïŒèããã«ãããã«ããžãã¹ã³ãŒãã®èšè¿°ãéå§ã§ããããã«ããŸãã ãŸããAngularã®ãŠãŒã¶ãŒã«æ¬æãè¡šããå¿ èŠããããŸããã³ã³ãœãŒã«ã¯ã©ã€ã¢ã³ãã¯emberjsã¯ã©ã€ã¢ã³ãã®äžã«æ§ç¯ãããŠããŸãã æã ãç§ã¯ãšã³ããŒã«åºäŒãã圌ãã®ã³ã³ãœãŒã«ã¯ã©ã€ã¢ã³ãã®å©äŸ¿æ§ã«åãã§é©ããŠããŸããããããã¯ç§ããã®æã«æ°ã¥ããå¯äžã®ãšã³ããŒã®å©ç¹ã§ããã
ã¿ã€ãã¹ã¯ãªãã
Typescriptãæåã«ç»å Žãããšãããã®ç®çãç解ãããåãã§ãã¯ã¯ãã¹ãŠãå·§åŠãã§ãããšä¿¡ããŠããŸããããŸããäžæ£ãªããŒã¿è»¢éã«ããå€ãã®æ¬ é¥ã¯ãããŸããã§ããã æéãçµã€ã«ã€ããŠãæ°ãå€ããããããŒããã±ãŒãžãReactãããžã§ã¯ãã«å°å ¥ããããšããè©Šã¿ãŸãããã1é±éã®èŠåŽã®åŸãç§ãã¡ã¯ããããããããªãã§çããããšãã§ãããšæ±ºããŸããã
次ã«ãTypescriptã§å®å šã«èšè¿°ãããŠããAngularã«æ³šç®ããããäžåºŠæäœããŠã¿ãŸããããšèããŸããã Typescriptã«åãæ¿ããŠæåã«æè¬ããã®ã¯ães6ãbabelãä»ã®ãã©ã³ã¹ãã€ã©ãŒã®èšå®ã§äžå¿ èŠã«å€§éšãããã«ç°¡åã«äœ¿çšã§ããããšã§ããïŒãããŠã次ã®æŽæ°ã§ã³ãŒãã¢ã»ã³ããªãå£ããªããšãã確å®æ§ïŒã ã³ãŒããèšè¿°ããã ãã§ãã³ã³ãã€ã©ã¯ããããåââé¡ãªães5ã«å€æããŸãã
ããããäœããããIDEã§ã®ã³ãŒãã®èšè¿°ãã¯ããã«äŸ¿å©ã§æ¥œãããã®ã«ãªã£ãããšãå¬ããæããŸã-èªåè£å®ãæ£ããæ©èœããã³ãŒãã³ã³ããã¹ããé¢ããããšãªãã¡ãœããã®ããã¥ã¡ã³ããèŠãããšãã§ããã³ãŒããèªå·±ããã¥ã¡ã³ãåãããŸããã ã¡ãœããã«æž¡ããªããžã§ã¯ãã®çš®é¡ãã³ã¡ã³ãã§èšè¿°ããå¿ èŠã¯ãªããªããŸãããããã«ããTypescriptãæäŸãããŸããã
å°ãåŸã«ãã€ã³ã¿ãŒãã§ã€ã¹ãšãã³ã¬ãŒã¿ã®é åã«æè¬ããŸããã ã¯ãããã¡ãããReactã䜿çšããŠTypescriptã§èšè¿°ã§ãããããAngularã®ãŠããŒã¯ãªãã©ã¹ã§ã¯ãããŸãããããã¬ãŒã ã¯ãŒã¯èªäœãTypescriptã§èšè¿°ãããŠããå Žåãã³ãŒãã®ã·ãŒã ã¬ã¹ãªçµ±åãå¯èœã«ãªããŸãã
ã³ã³ããŒãã³ãã¢ãããŒã
çŸåšã®ã»ãšãã©ãã¹ãŠã®ãœãªã¥ãŒã·ã§ã³ã¯ã³ã³ããŒãã³ãã¢ãããŒããã©ãã€ã ã䜿çšããŠãããAngularã¯ãã®ãããªãœãªã¥ãŒã·ã§ã³ãæäŸããæåã®äŒæ¥ã§ã¯ãããŸããã ãã ããAngularã¢ãããŒããä»ã®ãœãªã¥ãŒã·ã§ã³ã®ã¢ãããŒããšæ¯èŒãããšãããã€ãã®éãããããŸãã
htmlããŒã¯ã¢ããçšã®æ°ããã¿ã°ãäœæã§ããã ãã§ãªããæ¢åã®ã¿ã°ãå€æŽããããšãã§ããŸãã Reactã䜿çšãããšããéå±€å ã«äžèŠãªhtmlèŠçŽ ããªããŠãã¯ãªãŒã³ãªããŒã¯ã¢ãããäœæã§ããã®ã¯ããã€ããšã¯çšé ããã®ã§ãããããã¯ãã¬ã€ã¢ãŠããã¶ã€ããŒãéåžžã«æ©ãŸããŸããã Angularã§ã¯ãå±æ§ãä»ããŠæ¢åã®htmlã¿ã°ã®åäœãå€æŽã§ããŸããããã«ãããããŒã¯ã¢ãããããã¯ãªãŒã³ã§å¿«é©ã«ãªããŸãã
å¥ã®ãã¡ã€ã«ã«ã¬ã€ã¢ãŠããäœæã§ããŸãã ç§ãã¡ã®äŒç€Ÿã§ã¯ãJSéçºè ã¯HTMLã課ãããšãæ¬åœã«å¥œãŸãªãã®ã§ãã¿ã€ãã»ãã¿ãŒããããŸãã JSãšes6ã®ç¥èããªããŠãReactã³ãŒãã®ã¬ã€ã¢ãŠãã«æºãã£ããšãã圌ã«ãšã£ãŠã¯å°é·åãæ©ããŠãããããªãã®ã§ããã Reactã«ã¯ããŒã¯ã¢ãããã¬ã³ããªã³ã°ããæ©èœãããããšã¯ç¥ã£ãŠããŸãããå€ãã®JSé¢æ°ã«ãã£ãŠã³ãŒããçæããããšãããã»ã©åçŽã§ã¯ãããŸããã JSãæãããããã泚æãæãå¿ èŠã®ãªããã®ïŒãã¡ããæ瀺ã«ã€ããŠè©±ãïŒãã¿ã€ãã»ãã¿ãŒã«èª¬æããæ¹ãç°¡åã§ããããšãããããŸããã Pipeã䜿çšããããšã§ãããŒã¿åŠçã®è€éãªããžãã¯ããã¹ãŠã³ãŒããŒããé ãããšãã§ããå°ããªãã£ã¬ã¯ãã£ããæ£åšããŠããŸãã
Change Detectorã®ãã©ã¡ãŒã¿ãŒãŸãã¯CSSã¯ã©ã¹ã§ã®ã³ã³ããŒãã³ãã®åäœãå€æŽããããšã«ãããã³ã³ããŒãã³ãã®åäœãã«ã¹ã¿ãã€ãºã§ããŸãã ããã«ãåºæ¬ã³ã³ããŒãã³ãããç¶æ¿ãããšããã¹ãŠã®èšå®ãä¿åãããŸãã ãããã£ãŠã1ã€ã®ãã©ã¡ãŒã¿ãŒã§å€æŽäžå¯èœãªãªããžã§ã¯ãã®æ¯èŒã¢ãŒãã§å€æŽæ€åºåšã®åäœãæå¹ã«ãããã®ãããªåºæ¬ã³ã³ããŒãã³ãããç¶æ¿ããå Žåãå€æŽæ€åºåšã¡ã«ããºã ã®äžèŠãªãµã€ã¯ã«ãåé¿ã§ããŸãã ãã¡ãããããã«ã¯ãéçºè ãåºæ¬ã¯ã©ã¹ããç¶æ¿ãããšãã«è¡ãããšãç解ããå¿ èŠããããŸãã ã¹ã¿ã€ã«ã®ã«ãã»ã«åã«ãããå€ãã®ã³ã³ããŒãã³ãã®1ã€ã§æ¬¡ã«éžæãããã¯ã©ã¹ã®ååãéžæãããšããèŠçãåé¿ã§ããŸããã
- ã³ã³ããŒãã³ããå ¥åã§åãåãããšãã§ãããã©ã¡ãŒã¿ãŒãšãããããååŸã§ããã€ãã³ããæå®ã§ããŸãã ãã®åŸãè¿œå ã®ãã©ã¡ãŒã¿ãŒãã³ã³ããŒãã³ãå ¥åã«æž¡ãããšãããšãã³ã³ãã€ã©ãŒã¯ãã³ã³ããŒãã³ãããã®ãããªãã©ã¡ãŒã¿ãŒã«ã€ããŠäœãç¥ããªãããšãç¥ãããŸãã ããã«ãããå€éšã³ã³ããŒãã³ãã䜿çšããéã®ãšã©ãŒãåé¿ã§ããŸãã ãã¡ãããReactã«ã¯PropTypesããããããã䜿çšããŠã³ã³ããŒãã³ãã®å ¥åãå¶åŸ¡ããããšãã§ãããããAngularã¯ããã§ã¯äžæã§ã¯ãããŸããã
Rxjs
Angularã¯RxJSã©ã€ãã©ãªã®äžã«æ§ç¯ãããŠããã䜿çšããªãã®ã¯å¥åŠã§ããã ãããããã®ã©ã€ãã©ãªã«åããŠåºäŒã£ããšããç§ãã¡ã¯ãã£ãšããŸããã ããŒã¿ã®åŠçãã§ãŒã³ãæ£ããèšè¿°ããæ¹æ³ãèŠã€ããã®ã«æ°æ¥ããããŸããã çµæã¯ããã®ã©ã€ãã©ãªã«äœããæžã蟌ãããšããããšããã人ã ããèªãããšãã§ããã³ãŒãã§ãã ããã¯ç§ãã¡ããšãŠãæããããŠãRxJSã®äœ¿çšãæŸæ£ããããšããèããŸããã
å°ãæéãçµã£ãŠãããã¥ã¡ã³ããäœåºŠãèªã¿çŽããåäœäžã®ã©ã€ãã©ãªãè©Šããããã«æ £ããŸããã RxJSã©ã€ãã©ãªã䜿çšãããšãããŒã¿åŠçã§éåžžã«ã¯ãŒã«ãªããšãã§ããã»ãšãã©ã®å Žåãã³ãŒãã¯æå³ãããšããã«åäœããŸãã 確ãã«ãä»ã§ãã6ãæåŸãç§ã¯ãã®ã©ã€ãã©ãªã®å®å šãªãã¯ãŒãå®å šã«ã¯ç¥ããªãããšãç解ããŠããŸãã ãããããã®åŸãç§ã¯ããã䜿çšããããšãæåŠããå¯èœæ§ã¯äœãããšãç解ããŠããŸãã
ãã¡ãããRxJã¯Reactã«åã蟌ãããšãã§ããŸããããã¬ãŒã ã¯ãŒã¯ã§åããã®ã䜿çšããå Žåãããšãã°ãAngular HTTPã¢ãžã¥ãŒã«ã䜿çšããŠããã¯ãšã³ããæäœãããªã©ããã¬ãŒã ã¯ãŒã¯ã«ã³ãŒããç°¡åã«é¢é£ä»ããããšãã§ããŸãã
äŸåæ§æ³šå ¥
äŸåæ§æ³šå ¥ã¯ã»ãŒãã¹ãŠã®å Žæã§Angularã§äœ¿çšãããŠãããšããäºå®ããå§ããªããã°ãªããŸãããã€ãŸããéåžžã«å€§ããªå¢çå ã§ãã¬ãŒã ã¯ãŒã¯ã®åäœãå€æŽããããšãã§ããŸãã
ããã«ãAngularã®DIã¯æè»æ§ãé«ããããSingletonãFactoryãFacadeãªã©ãããç¥ãããŠããå€ãã®ãã¿ãŒã³ãå®è£ ã§ããŸãã ã³ã³ããŒãã³ãã®çžäºäœçšãããã¢ãŒãã«ãŠã£ã³ããŠããŠãŒã¶ãŒãžã®éç¥ã衚瀺ãããµãŒãã¹ã®äœæãŸã§ãããããå Žæã§DIã䜿çšããŠããŸãã ãããŠãã¡ãããããã¯ãšã³ãã§ã®ãã¹ãŠã®äœæ¥ã¯ããµãŒãã¹ãšDIãéããŠæ§ç¯ãããŸãã
ç§ã¯ããã䜿ã£ããã¬ãã£ããªçµéšãããã®ã§ãreduxã¢ãããŒãã®æ¯æè ã§ã¯ãããŸãã-ïŒãããžã§ã¯ãã®1ã€ã§ã倧éã®å®åã³ãŒããå€ãã®å Žåã倧èŠæš¡ãªreduxãµã¬ãã³ãã©ãŒãšã¹ããŒããŠã³ããã²ãã¿ãŒã®é 延ã«ããããããŠããŸããïŒã ãããããããééã£ãŠäœ¿çšãããããããŸããããããã¯ãã€ã³ãã§ã¯ãªãã£ãããã§ãã ãã®ã¹ã¿ãã¯å šäœãã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŠå®æãããããžã§ã¯ãã«çµã¿èŸŒã¿ãŸããããæ°ãããã®ã¯æ§ç¯ãããããã¯ãšã³ãã§äœæ¥ã匷åããŠããã¹ãŠãç¶æ ããã»ããµããã³å¯äœçšããã»ããµã«äŸ¿å©ã«é©åãããŸããã
ããããAngularã«æ»ããŸãã reduxã¢ãããŒãã¯å¿ èŠãªããããããããtrueã®åäžç¶æ ãã«ãããå Žåã¯ãAngularã§ãµããŒããããŠãããµãŒãã¹ãRxJSã³ã³ããŒãã³ããããã³UniderectialããŒã¿ãããŒã䜿çšã§ããŸãã ã³ãŒãã¯ã¯ããã«ã³ã³ãã¯ãã§ãããreduxã¢ãããŒããããæªããããŸããã æéãçµã€ã«ã€ããŠãã³ãŒããã»ãšãã©å€æŽããããšãªããããããªãã¥ãŒã¹ã¢ãããŒãã«å€æã§ããããã«ãªããŸãã ãã®ã¢ãŒããã¯ãã£ãæçµçã«ã©ã®ããã«èŠãããã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã
ã¢ãžã¥ãŒã«
Marionettejsã§åããŠã¢ãžã¥ãŒã«ã«åºäŒããä¿¡ããããªãã»ã©äŸ¿å©ã§ããã ã¢ãžã¥ãŒã«ãå€æ°ã®ãã¡ã€ã«ã«åå²ããŸã-åå¥ã«ã³ã³ãããŒã©ãŒãåå¥ã«ãã¥ãŒãªã© ãããŠãããªãªããããç§ã®ããã«ãã¹ãŠããŸãšããåŸã
Reactã§ãããžã§ã¯ããéçºããŠãããšããã¢ãžã¥ãŒã«ã«ã€ããŠããèŠããŠããŸããããReactã«ã¯ããã«äŒŒããã®ã¯äœããããŸããããã®ãããªãã®ãæ€çŽ¢ãããå®è£ ãããããæéã¯ãããŸããã§ããã ããã«å¯ŸããŠãAngularã¯æåããã¢ãžã¥ãŒã«ã®æŠå¿µãæäŸããŸãã ãŸããã³ãŒãããŒã¹ãšã®ã³ã©ãã¬ãŒã·ã§ã³ãå€§å¹ ã«ç°¡çŽ åãããŸãã ããžãã¹ã³ã³ããŒãã³ãã®ãã¹ãŠã®éšåãã¢ãžã¥ãŒã«ã«åéããã ãã§ãå¥ã®éçºè ãããã䜿çšããã«ã¯ãã¢ãžã¥ãŒã«ãã³ãŒãã«è¿œå ããã ãã§ãã
ã¢ãžã¥ãŒã«ã«ã¯ã³ã³ããŒãã³ãçšã®ç¬èªã®åå空éããããããå€éšã³ãŒãã§èª°ãããå éšããå©çšã§ããããšãå¿é ããå¿ èŠã¯ãããŸããã ããã¯ãæ®ãã®ã³ãŒãããã®åªããæœè±¡åã¬ã€ã€ãŒã§ãã ãããŠãã¡ãããä»ã®éçºè ã䜿çšã§ããããã«ãå¿ èŠãªã³ã³ããŒãã³ããå€éšã«ãšã¯ã¹ããŒãããæ©äŒããããŸãã
ããã«ãã¢ãžã¥ãŒã«ã¯ã³ãŒããææžåããããã®åªããããŒã«ã§ãã ãã¡ãããã¢ãžã¥ãŒã«ã䜿çšããæ©èœãããããããã«ã€ããŠç¥ãå¿ èŠããããŸãã æåã®æ©èœã¯ãã¢ãžã¥ãŒã«ã§å®çŸ©ããããµãŒãã¹ãã¢ããªã±ãŒã·ã§ã³å šäœã«ã¢ã¯ã»ã¹å¯èœã§ããããããã®ãµãŒãã¹ã®ååã«æ³šæããå¿ èŠãããããšã§ãã Angularã¯ãè¡çªãé¿ããããã«ãæ°ããJSæšæºã®Symbolã¿ã€ãã®é¡äŒŒç©ã䜿çšãããœãªã¥ãŒã·ã§ã³ãæäŸããŸãã
2çªç®ã®æ©èœã¯é 延èªã¿èŸŒã¿ã¢ãžã¥ãŒã«ã«é ãããŠããããã®ãããªã¢ãžã¥ãŒã«ããèªã¿èŸŒãŸãããµãŒãã¹ã¯ã¢ãžã¥ãŒã«å ã§ã®ã¿å©çšå¯èœã§ãã ããã¯ã補åããã©ã°ã€ã³ã·ã¹ãã äžã«æ§ç¯ãããŠããããµãŒãã¹ãžã®åŠšå®³ãããªãã¢ã¯ã»ã¹ãå¿ èŠãªãããåé¿çã暡玢ããããªãäžå¿«ãªæ©èœã§ãã ã¢ããªã±ãŒã·ã§ã³ã®éå§æã«ãµãŒãã¹ãæ©æã«ããªããŒãããããããã®æ©èœãé€å€ããŸããã
ãã¬ãŒã ã¯ãŒã¯ã®éçºãšãã®ãµããŒã
Reactãšã¯ç°ãªããAngularã¯ãã£ã1人ã®æ ªäž»ã§ããGoogleã«ãã£ãŠéçºãããŠãããç§ãã¡ã«ãšã£ãŠããã¯éèŠã§ãã ã¹ã¿ãã¯ã®éçºã¯æ¬è³ªçã«ã³ãã¥ããã£ã«ãã£ãŠè¡ãããŠããReactã®çµéšãããéžæãããã©ã€ãã©ãªããµããŒããããªããªã£ãããæ¬ é¥ãä¿®æ£ããçãéåžžã«äœãããšãäœåºŠããããããã«ããéçºãé ããªããŸããã
ããã©ã€ãã©ãªãå¥ã®ã©ã€ãã©ãªã«å€æŽããªããã°ãªãããã©ã€ãã©ãªããã©ãŒã¯ããŠç¬èªã®å€æŽãå ããå¿ èŠãäœåºŠããããŸããã ã¯ããAngularã§ããã«åœ±é¿ãããŸããããããã§ã¯ãã¬ãŒã ã¯ãŒã¯èªäœã«å€ãã®èŠçŽ ãå«ãŸããŠããããããµãŒãããŒãã£ã®ã©ã€ãã©ãªã¯ã¯ããã«å°ãªããªã£ãŠããŸãã Angularèªäœã®æ¬ é¥ã«ã€ããŠã¯ãç·æ¥ã®å¿ èŠãããå Žåã«ãAngularããŒã ããã®ææãµããŒãã䜿çšã§ããŸããããã¯ãåé¡ã®è§£æ±ºãå¥ã®è§£æ±ºçã®çºèŠã«åœ¹ç«ã¡ãŸãã ãããããã¡ãããããã¯å°ãã®äºç®ãè²»ããå¿ èŠããããŸãã
ãããã¯Angularãæã€ãã¹ãŠã®å©ç¹ã§ã¯ãªããç§ãã¡ã«ãšã£ãŠéèŠãšæãããå©ç¹ã ãã§ãã ããã«ãAngularã¯ã³ãŒããWebWorkersã«å€æããæ©èœãåããŠããããããã«ãã¹ã¬ããåããµãŒããŒãµã€ãã¬ã³ããªã³ã°ãªã©ãå¯èœã«ãªããŸãã çŸåšããããã®æ©èœã¯å¿ èŠãããŸããããå¿ èŠãªå Žåã¯ãã³ãŒããå€§å¹ ã«å€æŽããã«ãã€ã§ã䜿çšã§ããã®ã¯çŽ æŽãããããšã§ãã
çæ
ä»ã®ãœãªã¥ãŒã·ã§ã³ãšåæ§ã«ãAngularã¯çæ³çãªè£œåãšã¯ã»ã©é ããã®ã§ããããã¡ããçæããããŸãã
ããªãå¹³å¡ãªããã¥ã¡ã³ã
ããã¥ã¡ã³ãããããŸããããã®å質ã«ã¯å€ãã®èŠæããããŸãã å€ãã®å Žåãããã¥ã¡ã³ããéããšãã¯ã©ã¹ã¡ãœããã®ååã衚瀺ãããŸãããã¯ã©ã¹ã¡ãœããã®æ©èœãæ¹æ³ã«ã€ããŠã®èª¬æã¯ãããŸããã 説æãååšããå Žåã§ããçããŠããäŸããªããã°ãããããã®æ¹æ³ã䜿çšããæ¹æ³ãç解ããããšã¯åžžã«å¯èœãšã¯éããŸããã
Angularã§ã³ã³ããŒãã³ããåçã«äœæããããšãã人ã¯èª°ã§ãç§ãç解ããã§ãããã ããã€ãã®ããšãããã¥ã¡ã³ãã«æ¬ ããŠãããããç®æšãéæããæ¹æ³ãç解ããã«ã¯ã³ãŒããæãäžããå¿ èŠããããŸãã ããããæéã®çµéãšãšãã«ãã®åé¡ã¯è§£æ¶ãããããã¥ã¡ã³ããè¿œå ããããšæããŸãã
倧éã®çµæã³ãŒã
ããã«Angularã䜿çšããå Žåãåºåã§ã¯å€é¡ã®ã¢ãžã¥ãŒã«ãåŸãããããããæ鬱ãšæ²ãã¿ãçããŸãã ããããããã¥ã¡ã³ããå°ãæãäžãããšãåºåã®ã³ãŒãã®ãµã€ãºãå€§å¹ ã«åæžããå€ãã®ãœãªã¥ãŒã·ã§ã³ãèŠã€ããããšãã§ããŸãã ãããŠãããã€ãã®ã¢ãããŒãããããŸãã
䜿çšããŠããªãã¢ãžã¥ãŒã«ãé€å€ããŸãã ããšãã°ãAngularãæäŸããã¢ãã¡ãŒã·ã§ã³ãŸãã¯ãã©ãŒã ã䜿çšããªãå Žåããããã®ããã±ãŒãžãäžç·ã«ãã©ãã°ããå¿ èŠã¯ãããŸããã ãããžã§ã¯ãã®ãã«ãæã«ããªãŒã·ã§ãŒãã³ã°ã䜿çšããããšãã§ããŸããããã«ãããã³ãŒãããæªäœ¿çšã®ããŒããé€å€ãããŸãã ããšãã°ãããã«ããããããã¯ã·ã§ã³ã³ãŒãã«å«ããRxJSã®ãµã€ãºãå€§å¹ ã«åæžãããŸãã
AOTã³ã³ãã€ã«ã䜿çšããŸããããã«ãããã³ãŒãããã©ã³ã¿ã€ã ã³ã³ãã€ã©ãé€å€ãããéåžžã«éããªããŸãã 確ãã«ãããã¯ãã³ã³ããŒãã³ããåçã«çæããªãå Žåã«ã®ã¿å¯èœã§ãã ãã ãããã®å Žåã§ããã³ã³ãã€ã©ãå¥ã®ã¢ãžã¥ãŒã«ã«ç§»åããŠåå¥ã«ããŒãã§ããŸãã
- é 延èªã¿èŸŒã¿ã¢ãžã¥ãŒã«ã䜿çšããŸãã Angularã«ãŒã¿ãŒã¯ãããã¯ã¹ããã®é 延èªã¿èŸŒã¿ã¢ãžã¥ãŒã«ã§åäœããã¢ãžã¥ãŒã«ãèªã¿èŸŒãããã®æŠç¥ãéžæããããç¬èªã®ã¢ãžã¥ãŒã«ãäœæããããšãã§ããŸãã ããã©ã«ãã§ã¯ãã¢ãžã¥ãŒã«ã¯æåã«ã¢ã¯ã»ã¹ããããšãã«ã®ã¿ããŒããããŸãããã¢ãžã¥ãŒã«ã®ããŒããããã¯ã°ã©ãŠã³ãã§èšå®ã§ãããããã¢ãžã¥ãŒã«ã«ãã£ãŠããŒããããã»ã¯ã·ã§ã³ãžã®ç§»è¡ãé«éåãããŸãã
ç§ãã¡ã«ãšã£ãŠããã®ãã€ãã¹ã¯ç¹ã«éèŠã§ã¯ãããŸãããã¢ããªã±ãŒã·ã§ã³ã¯6ãæããšã«ãªãªãŒã¹ããã倧ããªè² è·ã¯ãªãããã©ãŠã¶ãŒã®ãã£ãã·ã¥ãç§ãã¡ãæãããã§ãã ãããŠã誰ããã¢ãã€ã«ããã€ã¹ããããã䜿çšããããšãæ³å®ããŠããŸããããã®ãããå¥åã®ãã€ãã£ãã¢ããªã±ãŒã·ã§ã³ãäœæããæ¹ãè¯ãã§ãããã
è€éãªãšã³ããªã®ãããå€
Angularã¯éåžžã«æŽç·Žããããã¬ãŒã ã¯ãŒã¯ã§ãã äžæ¹ã§ã¯ãcliã䜿çšããŠãç°¡åã«ã³ãŒãã®èšè¿°ãéå§ã§ããŸãããä»æ¹ã§ã¯ãå€æŽæ€åºæ©èœã®åäœæ¹æ³ãªã©ã®ããã¥ã¡ã³ããåŠç¿ããªããŠããéåžžã«æé©ã§ãªãã³ãŒããäœæãããããŸã£ããæ©èœããªãããšããã§ããŸãã
ãŸãããã®ãã€ãã¹ãæž¡ãããé 延ããŒãã¢ãžã¥ãŒã«ã®ãµãŒãã¹ãå¥ã®ã¢ãžã¥ãŒã«ã§è¡šç€ºãããªãçç±ãç解ããããšããŠå€ãã®æéãè²»ãããŸããã Angularã®è€éãã«å ããŠãRxJsã©ã€ãã©ãªã¯å€ãã®æéãè²»ãããŸãããããã¯ç°¡åã«ç解ã§ãããã®ã§ã¯ãããŸãããã䟡å€ããããŸãã
ãããã«
äžèšã«åºã¥ããŠãAngularã¯å€§èŠæš¡ãªã¢ããªã±ãŒã·ã§ã³ã®æ§ç¯ãæããããšã®ã§ããªãçã®äŒæ¥ãã¬ãŒã ã¯ãŒã¯ã«ãªã£ããšããçµè«ã«éããŸããã ããã¯äž»ã«ãRxJãšTypescriptã®éžæãªã©ãæ£ããè¡ããã決å®ã®ãã§ãŒã³ã§ããAngularã®æåã®ããŒãžã§ã³ã§ã®çµéšã®ç解ãšãè¡ããã決å®ã®æŽåæ§ã«ãããã®ã§ããã
Reactã¯è¯ãã¢ã€ãã¢ã®éãŸãã§ãããããã«äœ¿ããæ©èœãå€ããªããããå€ãã®å Žåã誰ããã³ãã¥ããã£ããæäŸãããæ©äŒããèªåã®ãã¢ã³ã¹ã¿ãŒããäœããŸãã ãã®çµæãæ°ããéçºè ãè€éãªãããžã§ã¯ãã«åå ããæéã¯Angularã®æéãããã¯ããã«é·ããªããå€ãã®å Žåãè¿é£ã®ããŒã ã§ããåé¡ãæ±ããŠããŸãã ããããç¹°ãè¿ããŸãããããã¯çŽç²ã«ç§ãã¡ã®æèŠã§ãããç§ãã¡ã®çµéšãšåµé ããããããžã§ã¯ãã«ç±æ¥ããŠããŸãã Angularãéžæããå Žåãéçºã®é床ãšãéçºè ãã³ãŒããå€æŽããŠè£œåãåé²ãããããšãã§ããéããéèŠã§ãã