ããã¹ã»ã€ãºãã€ããïŒ DenisIzmaylov ïŒ
ã¿ãªããããã«ã¡ã¯ïŒ ç§ã«ã€ããŠç°¡åã«èª¬æããŸãã ç§ã¯ããã¹ã»ã€ãºãã€ããã§ãã éå»5幎éãç§ã¯JSéçºã«æ³šåããŠããŸãããå€ãã®Single Page ApplicationãhighloadãReactãè¡ããMoscowJSãwebpackãªã©ã§äœåºŠãå®è¡ããŸããã
ä»æ¥ã¯ãããã«ã€ããŠã話ããããšæããŸãããªããåŸæ¥ã®åœ¢ã§ã·ã³ã°ã«ããŒãžã¢ããªã±ãŒã·ã§ã³ãæŸæ£ãã䟡å€ãããã®ã ååã¢ããªã±ãŒã·ã§ã³ã絊äžã«ã©ã®ããã«åœ±é¿ãããã ãããŠä»é±æ«ã¯äœãããŸããïŒ
Webpackã䜿çšããŠReact 14ã®çµéšããããES6ãã©ã®ããã«æ©èœããããç解ãããšã¯ã¹ãã¬ã¹/ã³ã¢ã§äœããè¡ããå°ãªããšãå圢ã®ã¢ããªã±ãŒã·ã§ã³ãäœã§ããããæ³åããŠã¿ãã°çæ³çã§ããŠãããŒãµã«ã
ããŒã1
ãŠã§ãã¯éåžžã«å€§ãããªããŸããã çŸåšããŠã§ãéçºã¯ãã§ã«ç§åŠãšèžè¡ã®éã®åªããã©ã€ã³ã«ãªã£ãŠããŸãã
以åã¯éåžžã«ã·ã³ãã«ã§ããããµãŒããŒäžã§äœããã®ã¹ã¯ãªãããäœæããJSãããã€ãè¿œå ããŠæ¬çªç°å¢ã«éä¿¡ããŸãããããã¹ãŠããŸããããŸããã
ãã©ãŠã¶ã¯ãµãŒããŒã«ãªã¯ãšã¹ããè¡ãããµãŒããŒã¯ãã¹ãŠãå®è¡ããäœããã®HTMLããŒãžãè¿ããŸããã
CSSãJS-ããã¯ãªãã·ã§ã³ã§ãããã»ãšãã©å¿ èŠãããŸããã ããŸããããŸããã ãããããã®åŸãSingle Page ApplicationïŒSPAïŒãç®ç«ã¡å§ããŸããã
ã¯ã©ã€ã¢ã³ãåŽã®ã³ãŒãã¯æé·ãå§ããŸããã ãµãŒããŒã¯ãã§ã«å°ããªåœ¹å²ãæããå§ããŠããŸãã ããŒãžããããã©ããã¯æåéããã§ãã¯ãããŸããããèš±å¯ãå¿ èŠã§ãããã¢ã¯ã»ã¹ã§ããŸããïŒ
ãããŠããµãŒããŒã¯ãã§ã«å°ããªHTMLãCSSãããã³å·šå€§ãªJSãã³ãã«ãæäŸããŠããŸãã
ããã§ã®å©ç¹ã¯éåžžã«å€§ãããã€ãŸã æžãå§ããã®ã¯ç°¡åã§ã-webpackã«é¢ããã¬ããŒããèŠãŠãèšå®ããå°ãã®HTMLãäœæããReduxãReactãæ¥ç¶ããŸããã
- è±å¯ãªæ©èœã åäžããŒãžã®å Žåãç§ãã¡ã¯ãã¹ãŠããã«ããŒãããŸãããŸããäœããæã£ãŠããªããšããäºå®ãå¿é
ããå¿
èŠã¯ãããŸããã ç»åãç»åããããªããã³ãã«ã«å
¥ããããšããã§ããŸãããããã¯æ©èœããŸãã
- å€æŽã¯ç°¡åã§ãååã«ç°¡åã§ããæé©åã«ã€ããŠå¿é
ããå¿
èŠã¯ãããŸããããã¹ãŠãæ©èœãããã¹ãŠãç§ãã¡ã«ãšã£ãŠæé«ã§ããã¹ãŠãã¯ãŒã«ã§ããè¿œå ãè¿œå ãè¿œå ããã ãã§ãã
- ã¬ã¹ãã³ã·ãUI-ãããã£ãŠããã¹ãŠãããŒããããäœãããŠã³ããŒãããå¿
èŠã¯ãããŸããã
- ããã¯ãã¹ãŠãã£ãã·ã¥ã«éåžžã«äŸ¿å©ã§ãã ããçš®ã®ãã³ãã«ãäžåºŠããŠã³ããŒããããšããã©ãŠã¶ã®ãã£ãã·ã¥ã«ä¿åããã次åããã«ããŒããããŸãã
ãããŠããã€ãã¹ã§ã¯ãããŸãããïŒ çæããããŸãã
第äžã«ããã³ãã«ã¯éåžžã«å€§ãããæã«ã¯3ã5 MBã«éãããããåããŠããŒãããã®ã«éåžžã«é·ãæéãããããŸãã ã€ãŸã å€ãã®å Žåããµã€ãããªãœãŒã¹ã«åããŠã¢ã¯ã»ã¹ãããšãããŸãã¯æåŸã®ãµã€ãã«æŽæ°ããåŸãå€ãã®äººãæ°ã«å ¥ããªããã€ãŒã«ã衚瀺ãããŸãã T.O. ã¢ããªã±ãŒã·ã§ã³ãžã®æåã®ã¢ã¯ã»ã¹ã«ã¯é·ãæéãããããŸãã ãããè¿ éã«å®è¡ãããŸããã ãããŠããã®èšæ¶ã¯ãã¡ããšé£ã¹ãŸãã
ãµããŒãã®è€éãã 倧èŠæš¡ãªåäžããŒãžã¢ããªã±ãŒã·ã§ã³ã¢ããªã±ãŒã·ã§ã³ããµããŒããã人ã¯ãäžéšã®ãã©ã°ã€ã³ïŒåã ã®ããŒãžã§ããïŒã«è¿œå ãããã©ã°ã€ã³ãä»ã®ããŒãžã«åœ±é¿ãäžããããšãå€ãããšãç¥ã£ãŠããŸãã ã€ãŸã å®æ§çã«å¶åŸ¡ããããšã¯ã§ããŸããã ãããŠã¡ã¢ãªãªãŒã¯ã ãã¹ããã人ã¯ã»ãšãã©ããŸããããã¢ããªã±ãŒã·ã§ã³ã倧ãããã¿ãå ã§é·æéæ©èœããå Žåãã¡ã¢ãªã倧ãããªãããšããããããäœããã®çç±ã§ãã¹ãŠããã³ã°ãå§ããŸãã 3ã4æéçµéããŸãã...ããããååãšããŠãã¹ãããŠããŸããã
ãããã£ãŠãé·ãè² è·ããµããŒãã®è€éãã空çœããŒãžã1ã€ã®URLïŒããããªããã€ãã¹ã«ãªãã®ãã説æããŸãïŒããã³å€ããã©ãŠã¶ãŒã æè¿èª¿æ»ãå®æœãããšããã2015幎ãã2016幎ã®ä»ã§ãããã¹ãŠã®ãã©ãŠã¶ãŒãæŽæ°ããå¿ èŠãããããã«èŠããŸããããããã§ã¯ãããŸããã§ããã 5ïŒ ã¯12çªç®ã®Operaãš7-8çªç®ã®IEã§ã6çªç®ã¯IEã§ããããŸãã å é±èŠãŸããã
ããã¯çæã§ããïŒ ããžãã¹ã«ãšã£ãŠããããã¯çæã§ãã
é·ãè² è·ã¯UXã®æ倱ã§ãããå€ãã®ãéãæè³ãããŸãã ãµããŒãã®è€éãããªã¹ã¯ã§ãã ãããã¯ãæéã«éã«åãããäºç®ããæãåºããªã¹ã¯ã§ãã 空çœã®ããŒãžã¯SEOã®åé¡ã§ãã ããã§ã¯ãå€ãã®äººããã®ãããªç°è«ãæã£ãŠããå¯èœæ§ããããŸããäºåã¬ã³ãã©ãŒãååšãããããAngularã¢ããªã±ãŒã·ã§ã³ã¯äºåã«ç°¡åã«ã¬ã³ããªã³ã°ã§ããŸãã ããããããã¯æ¬è³ªçã«ããã¯ã§ãã ãã®ç¹ã§ã®æ©äŒã¯ã»ãšãã©ãããŸããã 1 URLã¯SMMã®åé¡ã§ãã SMM-ããã¯ããŠãŒã¶ãŒããœãŒã·ã£ã«ãããã¯ãŒã¯ã§ããŒãžãå ±æã§ããªãããšãæå³ãã1ããŒãžã«ã€ãªãããŸãã ãããã£ãŠããã®ããŒãžãå€ããã©ãŠã¶ã§æ©èœããªãå Žåãããªãã£ã«ããªããå€ããçŸåšæåŠããŠããå Žåããããã®5ïŒ ã®å€ããã©ãŠã¶ã®äººã«ã¯ç©ºçœã®ããŒãžã衚瀺ãããŸãã ããã¯ãã¹ãŠäºæ¥è²»ã§ãã
ã©ããã ããã§ãããã2ã€ã®äžçã®ãã¹ãã掻çšããååã¢ããªã±ãŒã·ã§ã³ã®åœ¢ã§ãããè¡ãããšãã§ããŸãã
2011幎ãCharlie Robbinsã¯ãå圢ãšã¯ãååŸããåè¡ããµãŒããŒãšã¯ã©ã€ã¢ã³ãã®äž¡æ¹ã§å®è¡ã§ããã³ãŒããæå³ããããã«ãããå®åŒåããŸããã ããã€ãã®äŸå€ãé€ããŸãã
ããã§ã次ã®è³ªåãçºçãããããããã§çŠç¹ãåãããŠç解ããããšãéåžžã«éèŠã§ãïŒå ±ææ¹æ³ãããã³ååã¢ããªã±ãŒã·ã§ã³ãæŽçããæ¹æ³ïŒ ãã³ãã¬ãŒãããµãŒãã¹ãéçãã¡ã€ã«ãã¢ã¯ã·ã§ã³ããªãã¥ãŒãµãŒãªã©ããããã®ããŒããæ®éçã«å®å šã«éç«ã£ãŠãããå°ããªéå§ç¹ã§ããããã«å®åŒåããããšããŸãã-ã¯ã©ã€ã¢ã³ããã¡ã€ã«ããŸãã¯ç®¡çããã«ãã€ãŸã ã«ãŒã¿ãåæåãããã®-ãµãŒããŒéšåãã¯ã©ã€ã¢ã³ãéšå-ç¬èªã®ãã®ãæã€ããšãã§ããŸãã
ãã©ãŠã¶ãŒããããããã³ããšã³ããµãŒããŒïŒåå¥ã«å²ãåœãŠãããŠããïŒããããå€ã䜿ãæ £ããããã¯ãšã³ããµãŒããŒãããããã«èŠããŸãã äœããã®ãµãŒããŒã®ãªãããŒã¿ããŒã¹ã§ãããŸããŸããã ãã©ãŠã¶ã¯ããã³ããšã³ããµãŒããŒã«ã¢ã¯ã»ã¹ããå€ããµãŒããŒãŸãã¯ããŒã¿ããŒã¹ã®ã©ããã«ããŒã¿ãéä¿¡ããŠãããŒã¿ãåä¿¡ã§ããŸãã
次ã«ãå®å šãªHTMLã圢æããéèŠãªCSSãã¬ã³ããªã³ã°ã§ããŸããããã¯ããã®ããŒãžã®ã¬ã³ããªã³ã°ã«ã®ã¿å¿ èŠã§ãããSPAã®å Žåã®ããã«ãå¿ èŠãªã¢ããªã±ãŒã·ã§ã³å šäœã®ã¬ã³ããªã³ã°ã«ã¯å¿ èŠãããŸããã
æåŸã«ãJSãã³ãã«ãæäŸããŸãã ãã®æç¹ã§ãããã³ããšã³ãã¯ã©ã€ã¢ã³ããã¯ã©ã€ã¢ã³ãåŽã§ã¢ã»ã³ãã«ãããã¬ã€ãºãããŸããããã«ãããããšãã°RESTful APIãä»ããŠãããã¯ãšã³ããµãŒããŒãšä»¥åã®ãµãŒããŒãšã®ãããªãéä¿¡ãå®è¡ã§ããŸãã
åèšã§ãåäžã®ã©ã³ã¿ã€ã ãå ±éã®ã³ãŒãããŒã¹ãããã³å®å šãªã³ã³ãããŒã«ããããŸããããã¯ãããšãã°Javaãªã©ã®ããã¯ãšã³ããµãŒããŒãããå Žåãããã³ããšã³ãéçºè ããµãŒããŒã«ããã€ãã®å€æŽã圱é¿ãåãŒãããããã·ã¥ãããããå¯èœæ§ãããããã§ã ç¹°ãè¿ããŸããããšã³ã·ã¹ãã ããããŸãã ããŒãããã±ãŒãžãããŒãžã£ãŒã
人çã§ãããå®çŸããã«ã¯ïŒ ãµãŒããŒåŽã¬ã³ããªã³ã°çµç±ã
äžçªäžã®è¡ã¯ããµãŒããŒåŽã¬ã³ããªã³ã°ã䜿çšããŠæ§ç¯ããããšã§ããããšãã°ãReactäžã®ã¢ããªã±ãŒã·ã§ã³å šäœã®ã¢ã»ã³ããªã¯ãNode.jsäžã®ããã³ããšã³ããµãŒããŒäžã§è¡ãããŸãã åæã«ãå°å³ãå³åº§ã«ååŸããŸãã ã¢ããªã±ãŒã·ã§ã³ãã¬ã³ããªã³ã°ãããšãJSãããŒãããåã§ãã£ãŠããããã«HTML圢åŒã§ååŸããŸãã ãããŠããŠãŒã¶ãŒã¯ããã«ãããèŠãŸãã ã€ãŸã æåã®æ§èšŽã§ã ãããŠãJSãããŒãããããšãReactã¯åã«ã€ãã³ããã³ãã©ãŒãè¿œå ããã ãã§ãããã¯ãã¹ãŠéåžžã«è¿ éã«è¡ãããŸãã
ãµãŒããŒåŽã®ã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
ã€ãŸã ç¹å®ã®Reactã¬ã³ãã©ãŒããããŸããããã¯14çªç®ã®ããŒãžã§ã³ã§ããããŸãã«ã¢ããªã±ãŒã·ã§ã³ã§ãã ã€ãŸã æååã«ã³ã³ãã€ã«ããŠã¬ã³ããªã³ã°ããŸãã ã¢ããªã±ãŒã·ã§ã³å ã®ãã¹ãŠã®ã«ãŒããæ¢ã«ã©ããããŠããããšã¯æããã§ãã åãã³ãŒããå®è¡ããäœããã®æ¹æ³ãããããšãæ¢ã«ç¥ã£ãŠããŸãããã®æ¹æ³ã§äœãã衚瀺ããå¿ èŠããããå¿ èŠãªããªãŒã衚瀺ãããŸãã
æåŸã«ãäœããããŸããïŒ ãŠãŒã¶ãŒã«ã¯ããã«ããŒãžã衚瀺ãããããŒã¿ã®è¿œå ãªã¯ãšã¹ãã¯ãããŸããã衚瀺ããããã«ãå¿ èŠã«å¿ããŠãã¹ãŠã®ããŒã¿ãæ¢ã«åéããå éšã«é 眮ããŠããããã§ãã ãŸããJSããªããŠãããŒãžãéå§ã§ããŸãã ãããã®5ïŒ ãšåãã¬ã¬ã·ãŒãã©ãŠã¶ã§äœæ¥ããããšãéåžžã«éèŠã§ãã ããã§äœããæåŸã®ã¯ããŒã ã®ããã«ã¯ãŒã«ã«æ©èœããªããšä»®å®ããŸãããå€ããå°ãªããåäœããŸãã å®å šãªURLããã²ãŒã·ã§ã³ãšã¡ã¿ã¿ã°ã®äž¡æ¹ãã€ãŸã ããã§ãããã·ã¥ã䜿çšãããããã¯ããã«å¹ççã«ãåã ã®ããŒãžãžã®ãªã³ã¯ãå¹ççã«ããã£ãããããã€ãã®ãªã³ã¯ãå ±æãããããããšãã§ããŸãïŒç¹ã«éèŠã§ãïŒã åæã«ãç§ãã¡ãæã£ãŠããJSã«é¢é£ãããã¹ãŠã®æ©èœãä¿æããŠããŸãã
ããŒã2.ããã©ãŒãã³ã¹ãšã¹ã±ãŒãªã³ã°ã ã¹ã±ãŒãªã³ã°ãšã¯è² è·ã®ããã©ãŒãã³ã¹ã§ã¯ãªããæ©èœã®ã¹ã±ãŒãªã³ã°ãã€ãŸãæé·ã®æ¹æ³ã§ãã
ãµãŒããŒãµã€ãã¬ã³ããªã³ã°ã®å Žåããã¹ãŠã®ããŒã¿ãæã£ãŠãããšãã¹ãŠãã¹ãŒããŒã«ãªããŸãã Node.jsã¯ã·ã³ã°ã«ã¹ã¬ããã¹ããŒãªãŒã§ããããšã誰ããç解ããŠããŸãã éåžžã®JSãšåæ§ã«ãããŒã¿ãããå Žåã¯ãã¹ãŠãã¹ãŒããŒã§ããã1ã€ã®ã¹ã¬ããã§ãã¹ãŠãæç»ã§ããŸãã
ãããããã®ããŒã¿ãååŸããå¿ èŠãããå Žåã¯ã©ãã§ããããïŒ åæã«ãªã¯ãšã¹ããè¡ãã«ã¯ãçŸåšã®ã€ãã³ãã«ãŒãã§ããã¹ããªãŒã ããããã¯ããæš©å©ããããŸããã
ããã«ã¯ã3ã€ã®äž»ãªæ¹æ³ããããŸããå¿ èŠãªããŒã¿ãæåã§ååŸãããããåä¿¡ç¶æ ãšããŠæäŸããæ¹æ³ã Facebookãªã¬ãŒã䜿çšãã Redux-catch-promiseã®ãã©ã°ã€ã³ãéçºããŠããŸããã
ããŒãžããšã«æåã§-ãã¹ãŠãéåžžã«ç°¡åã§ããããŒã¿ããŒã¹ããç¶æ ãååŸããrenderToStringã«æž¡ããŸãã ãã®çš®ã®å€æŽã¯äœããããŸãããããã®å ŽåãåããŒãžã«ã€ããŠèããå¿ èŠããããŸããããã®ããŒã¿ããµãŒããŒã§ã©ã®ããã«åãåãã®ã§ããããïŒ ããŒãžãååŸããŠè¿œå ããããšã¯ã§ããŸãããäœããã®æ¹æ³ã§ãã®ããŒã¿ãæœåºããç»ããè¿œå ã®ãšã³ãã£ãã£ããããžã§ã¯ãã«å ¥åããå¿ èŠããããŸãã ãŸããå¿ ããã䟿å©ã§ã¯ãããŸããã
圌ããæ°ãæåã«çºè¡šããFacebookãªã¬ãŒã¯ãã³ã³ããŒãã³ãå ã®ããŒã¿ã«å¯Ÿããç¹å¥ãªãªã¯ãšã¹ãã宣èšçã«èšå®ã§ãããã¬ãŒã ã¯ãŒã¯ã§ãã éåžžã«èå³æ·±ã話ãã€ãŸã èŠæ±ãå¿ èŠãªããŒã¿ãããããçµã³ä»ããããŠããæ¡ä»¶ã宣èšçã«ç€ºããŸãã ãªã¬ãŒã¯ãã®ãã¹ãŠã®ããŒã¿ãèç©ããããã«ãµãŒããŒã«ãããæããŸãããããŠããªãã¯ããããã¹ãŠäžåºŠã«ååŸããŸãã ã€ãŸã ããã¯ãå ã»ã©èª¬æããã¯ãšãªã®ãããåŠçã§ãã å¯äžã®åé¡ã¯ãããããµãŒããŒã§ãŸã å©çšã§ããªãããšã§ãã ãµãŒããŒåŽã§ããã2016幎ã®ç¬¬1ååæã«ã¯ãFacebookã¯æ¢ã«ãããå®è£ ããããšãçŽæããŠããããã¹ãŠãæ©èœããŸãã GitHubã®åé¡ãžã®ãªã³ã¯ããããŸããã芧ãã ããã
Redux-catch-promiseã¯ã1ã€ã®ãããžã§ã¯ãã§åããŠããéã«äœã£ãçã寿åœã§ãã Reduxãšã¯äœã§ããïŒ MoscowJSã§åœŒã«ã€ããŠè©±ããŸããã ããã¯ãReactã®ç¶æ ã³ã³ãããŒã§ãã å®éãããã¯Fluxã®ä»£æ¿åã§ããã瀺ãããŠããããã«ã¯ããã«æåãã代æ¿åã§ãã ã¹ããŒããžã®ãªã³ã¯ããããŸãã Redux-catch-promiseã¯ããã«ãŠã§ã¢ã§ãã reduxã®ãã©ã°ã€ã³ã
圌ã¯äœãããŠããŸããïŒ ã¹ããªãŒã å ã®Promiseã¢ã¯ã·ã§ã³ããã£ããã£ããã¢ããªã±ãŒã·ã§ã³ãã¬ã³ããªã³ã°ããããã«ã³ãŒã«ããã¯ãåããŸãã ã³ã³ããŒãã³ããã¬ã³ããªã³ã°ãããšãã«ããªã¯ãšã¹ããè¡ãããŸãã ããŒã¿ãåä¿¡ããŠââPromiseã«å¿çããŠãã£ã¹ãããããã¢ã¯ã·ã§ã³ãéä¿¡ããŸãã ãã®Promiseã¯ãã¢ããªã±ãŒã·ã§ã³ãã¬ã³ããªã³ã°ããæäžäœã§ãã£ãããããã®çµæãPromiseã®ã³ã¬ã¯ã·ã§ã³ãååŸããŸãã ãã®èš±å¯ãåŸ ã£ãŠãåä¿¡ããããŒã¿ã§ã¢ããªã±ãŒã·ã§ã³ãåã¬ã³ããªã³ã°ããŸãã ããã§ã¯ãæååä¿¡ãšçŸåšRelayã«å®è£ ãããŠãããã®ãšã®åŠ¥åç¹ã§ãããéåžžã«äŸ¿å©ãªçµæãåŸãããŸããã
GitHubãžã®ãªã³ã¯ã¯ããã«ãããŸããäŸããããŸãããå°ãå€ããããããŸããããããã§ã¯ãã¹ãŠãéåžžã«è¿ éã«å€æŽãããŸãã
ããã©ãŒãã³ã¹ã¯2çªç®ã®éšåã§ãã
ãµãŒããŒãµã€ããéåžžã®MacBookã§ã©ãã ãéãã¬ã³ããªã³ã°ããããã確èªãå§ãããšã...
ç解ããããã«ããã®ããŒãžã¯56 Kãã€ããå æããæåéã4ã€ã®ç»é¢ãå°ããªãããã¡ã€ã«ã§è¡šç€ºãããŸã...
ãã¹ãŠã®ããŒã¿ã䜿çšããŠããã¹ãã®ããã«abãååŸããŸãããããªã¯ãšã¹ãã¯å®äºã§ãã 61ããªç§ã
ãããããããããã®ãããããšãå°ããªã®ãã¯æ確ã§ã¯ãããŸããã åãããã«ãHendlebarsãå®è¡ãããšã8ããªç§ã«ãªããŸãã
éãã¯ãã£ãšã¯ã£ããããŠãããšæããŸãããããã¯ããã»ã©ã§ã¯ãããŸããã
ç§ãã¡ã¯äœããæ¢ãå§ããèŠãŠãGoogleã«è¡ããŸã-å ·äœçãªãã®ã¯äœããããŸããã ç§ãã¡ã¯ãã€ãã¿ãŒã«å°ããããšããŸãã誰ããé»ã£ãŠããããªãã€ãŒããããŠããŸãããçãã¯èŠã€ãããŸããã
åæã«ãNODE_ENVãéçšç°å¢ã«å ¥ããŠã¿ãŸãããã
ããŒã³ãããŠ-ãã ïŒ -ã»ãŒ2åã®é床ã çŽ æŽããããé¢çœãã è¯ãèŠããŸãããããã§ãã±ãŒãã§ã¯ãããŸããã
ã©ãã èŠãŠã¿ãŸããããGitHubã®åé¡ã§ç»ããŸãã
ãnpm reactã䜿çšãããšãµãŒããŒã®ã¬ã³ããªã³ã°ãé ããªãããªã©ã®èå³æ·±ããã®ãèŠã€ããŸãããã ããã§ããã¡ã€ã«ãæ瀺çã«react.min.jsã«ã€ã³ã¯ã«ãŒãããã ãã§ãªããã€ã³ããŒãããã³ãªã¢ã¯ã·ã§ã³ãè¡ãã ãã§ãªããæ¥ç¶ããå¿ èŠããããšãã決å®ãäžãããŸãã
ã§ã¯ãè©ŠããŠã¿ãŸãããã ãã¹ãçšã«ããã€ãã®node_modulesãäœæããŸãããã æž æœãã®ããã«ããããŸãã ããã§ã¯ãmin.jsãæ瀺çã«äœ¿çšããŸãã ãããŠæåŸã«ãããã¯ã©ã®ããã«çµæãå€ããŸãããïŒ å§ããŸãã
ããã«é ããªã£ãã
ãã¹ãã倱æããã¹ã©ã€ãã
çµå±ã®ãšããããã®ã¢ããã€ã¹ã¯Reactã®éå»ã«ã¯ããŸããããŸãããã14æ¥ã«ã¯ããŸããããŸããã§ããã å šäœåã¯æ¬¡ã®ããã«ãªããŸãã
ã€ãŸã Hendlebarsã«ã¯8ããªç§ããããŸããå®éã«ã¯ããããã¯ã·ã§ã³ãæå®ããå Žåããã以å€ã¯ãã¹ãŠã玫-js minã䜿çšããå Žåã¯ãã¹ãŠã§ãã ããã39ïŒ å°ãªãã
ããã«ããã€ãã®ã°ããŒãã«ãªèª¿æ»-ãµãŒããŒåŽã¬ã³ããªã³ã°ã®ããã¯ã¯èŠãããŸããã Reactã¬ãã«ã§ã¯ãä»ã®ãšãããã¹ãŠãæé©åããå Žæã¯ãããŸããã çéå ¥ãã®ååãªæ¹æ³ãããããŸããã
ãããã°ããŒãã«ã«å ±æããããªã³ã³ãã€ã«ãšãã£ãã·ã¥ã䜿çšãããšãã¬ã³ããªã³ã°ãåé¢ãããŸãã ãŸããæè¿ãªãªãŒã¹ãããReact DOM Streamãã©ã°ã€ã³ã䜿çšããŸãã Facebookã®äœ¿çšBigPipeã¯ãFacebookã®éåžžã«èå³æ·±ãæ¡åŒµæ©èœã§ãããé·ãé䜿çšãããŠããŸããã HAProxyã¯ãã¬ããŒãã®ä»ã®ã»ã¯ã·ã§ã³ã§ããdevopsã«ã€ããŠè©³ãã説æããŠããŸãã
ããªã³ã³ãã€ã«ã®æ¬è³ªã¯äœã§ããïŒ å®éãUIãç¶æ ã®ç¹å®ã®é¢æ°ãå®è¡ããçµæã§ãããšããäºå®ããéå§ããå Žå-fïŒstateïŒãããã§fã¯Reactã³ã³ããŒãã³ãã§ãããç¶æ -ããã¯ãããçš®ã®å Žåãåãªããã¹ã«ãªããŸããµã€ããŸãã¯ããŒãžã®ããªãŒããŸãã¯ä»ã®äœãã«çµã³ä»ããããšãã§ããŸãã ã¬ã³ããªã³ã°ãããã®ããŒã䜿çšããŠãHTMLãç°¡åã«ãã£ãã·ã¥ã§ããŸãã
ç°¡åãªè§£æ±ºçã¯ãredisã䜿çšããããšã§ãã ããã«è¿ éã«å¯Ÿå¿ããå¿ èŠãããå Žåã¯ãredisããã¥ãŒãã¯ãŒã«ãŒã䜿çšã§ããŸãã ã€ãŸã äœããã®ãã€ãŒã«ã瀺ããéšåçãªèªã¿èŸŒã¿ãè¡ããããã¯ã°ã©ãŠã³ãã§ãã¯ãŒã«ãŒã¯ãã¹ãŠã®ãªã¯ãšã¹ãã§ã³ã³ããŒãã³ããã¬ã³ããªã³ã°ããŸãã ããã§ãæåã®ã¬ã³ããªã³ã°ãã©ãã«ããããååŸããŸããæ¬è³ªçã«ããã®å ŽåãããŒãžã¯ããã«äžãããããã¹ãŠãããã¯ã°ã©ãŠã³ãã§ã¬ã³ããªã³ã°ããã次ã®ãªã¯ãšã¹ãã§ãã³ã³ããŒãã³ãã®ãã£ãã·ã¥ãããéšåããã§ã«äžããããšãã§ããŸãã
ã¬ã³ããªã³ã°ã®åé¢ã Linkedinã¯èª¿æ»ãå®æœããŸããããã»ãšãã©ã®ããŒãžïŒç¹ã«é·ãããŒãžïŒã§ãµãŒããŒã¬ã³ããªã³ã°ãå®å šã«è¡ãå¿ èŠã¯ãªããæåã®éšåïŒè¡šç€ºãããŠããéšåïŒã衚瀺ããã ãã§ååã§ããããšãããããŸããã ãŸããä»ã®ãã¹ãŠãåå¥ã«ã¢ããããŒãããããšãã§ããŸããããšãã°ãã¯ã©ã€ã¢ã³ãåŽã®JSã§ãã ãããŠã»ãšãã©ã®å Žåã圌ãã¯åœŒãã®æåã®éšåã ããèŠãŸããã誰ãã¹ã¯ããŒã«ããŸããã§ãããããªãã¡ ãã®ãããæåã®éšåããµãŒããŒã«ã¬ã³ããªã³ã°ããŠããã«æäŸã§ããŸãã次ã®éšåã¯ãã§ã«JSãä»ããŠããã°ã©ã ã§ããŠã³ããŒããããŠããŸãã ããã«ãããããã©ãŒãã³ã¹ãšãªãœãŒã¹ã®é¢ã§ããªã倧ããªå©ç¹ãåŸãããŸãã
React DOM Streamã¯æ¬¡ã®æ¡åŒµæ©èœã§ã-ããã¯æè¿å ¬éããããããžã§ã¯ãã§ãã ç·ïŒaickinïŒã¯Reactãåå²ãããããã«éåžžã®httpãªã©ã®æ©æãªã»ããã®ãã¯ãããžãŒãå®è£ ããŸããã ã¬ã³ããŒã¬ã³ããªã³ã°ããŠãããã«ãã¹ãŠãåŸãããŸãã ãã®å ŽåãHTMLã³ãŒãã®åœ¢åŒã§ã¯ãªããã³ã³ããŒãã³ããã¬ã³ããªã³ã°ãããŠãããããããã«ã¹ããªãŒã ãµãŒããŒã«ãã³ãããããšãã«ã圌ã¯ããã«ãã¯ãããžãå®è£ ã§ããŸããã éåžžã«èå³æ·±ãããã©ãŒãã³ã¹å¹æãåŸãããŸãã æåã®ãã€ããŸã§ã®æéã¯ãã§ã«65ïŒ ççž®ãããŠããŸãã ããã¯ã»ãŒ2åã§ãæåŸã®ãã€ããŸã§-37ïŒ ã§ãã ãããã®2ã€ã®ã¢ãããŒããçµã¿åããããšãéåžžã«ããŸããããŸã... Reactèªäœã«åœ±é¿ããå¯äžã®ãã€ãã¹ç¹ã¯ãå°ãæ¹åããå¿ èŠããããããããã«ãã©ãŒã¯ã䜿çšããããšã§ãããã¯å ¬åŒã®Reactã§ã¯ãããŸããã çŸåšããã®ããŒãã«é¢ããè°è«ããããŸããã芧ããã ããŸãããŸããªãæºåãæŽããŸãã
Facebook BigPipeã éåžžã«ã¯ãŒã«ãªæ¡åŒµæ©èœã 圌ãã¯ãããéåžžã«é·ãæéãçŽ2ã3幎åã«ããŸããã ããã¯ãèªã¿èŸŒã¿ããã»ã¹äžã«ããŒãžãçµã¿ç«ãŠããããšãã§ãã ã€ãŸã ãã¹ãŠãç§ãã¡ãšäžŠè¡ããŠããŒãããããããããšã©ãŒèæ§ãåŸãããŸãã æ¬è³ªã¯ããã§ããããŒãžããããããã»ã¹ã§éžæããŠããŒãã§ããç¹å®ã®éšåããããŸãã ã€ãŸã ããŒãžãããŒãããéçšã§ããããã®ãããã¯ã«å¿ èŠãªJSãCSSã®åŒã³åºãã圢æããããŒã¿ã¯äœããã®jsonãã€ããä»ããŠèªåçã«ããŒããããŸãã
æåã«ã¬ã³ããªã³ã°ãããšããã®ãããªã»ãŒå®å šãªããŒãžã衚瀺ãããŸãã ããšãã°ãYandexã®ããã«ãéèŠãªãã®ãèŠãããšãã§ããŸãã Yandexã§ã¯ãæ€çŽ¢ãã¬ãŒãºãå ¥åããŠEnterããŒãæŒããšãæåã«ãªã¯ãšã¹ãã®ãããããããŒã«ããŒã衚瀺ããããã®åŸã§çµæèªäœãèªã¿èŸŒãŸããŸãã ããã«ããã»ã¹ãæãããŠããŸãã
HAProxyã DevOpsã«ã€ããŠã¯å°ãã§ãããDevOpsã¹ãã·ã£ãªã¹ãã«èª°ããã¢ã¯ã»ã¹ã§ããããã«ãªã£ããšæããŸãããåŸã§ä»ã®èšå®ãè¡ãããšãã§ããŸãã èŠç¹ã¯ãå®çšŒåç°å¢ã§ã¯ãããã€ãã®ããŒããäžããŠããããã®éã§æ¢ã«åŸªç°ãããæ¹ãè¯ããšããããšã§ãã
çµè«ãšããŠãç§ã¯ããã€ãã®æçšãªè³æãæäŸããããšæããŸãã
- ããŒãžè² è·ã®é絊ïŒ100æ¥éã®Google DevïŒ https://youtu.be/d5_6yHixpsQ
- Netflix.comã®é«éåhttp://techblog.netflix.com/2015/08/making-netflixcom-faster.html
- æ°ããLinkedInããŒã ããŒãžã®æ°ãããã¯ãããžãŒhttps://engineering.linkedin.com/frontend/new-technologies-new-linkedin-home-page
- twitter.comã§ã®ããã©ãŒãã³ã¹ã®æ¹åhttps://blog.twitter.com/2012/improving-performance-on-twittercom
- å圢JavaScriptã³ãŒãã®ã¹ã±ãŒãªã³ã°https://blog.nodejitsu.com/scaling-isomorphic-javascript-code/
- AngularJSããReactãžïŒå圢ã®æ¹æ³https://blog.risingstack.com/from-angularjs-to-react-the-isomorphic-way/
- å圢JavaScriptïŒWebã¢ããªã®æªæ¥http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/
- ReactãµãŒããŒåŽã®ã¬ã³ããªã³ã°ããã©ãŒãã³ã¹http://www.slideshare.net/nickdreckshage/react-meetup
- ããã°ã¬ãã·ãHTMLã¬ã³ããªã³ã°ã®å€±ãããèžè¡https://blog.codinghorror.com/the-lost-art-of-progressive-html-rendering/
ãŸããæšå¥šäºé ãšããŠãMoscowJSã³ãã¥ããã£ã«åå ããŠã楜ãã¿ã«ã
ç§ãã¡ã«ã¯åžžã«é¢çœãããšãèµ·ãããŸãã
æãéèŠãªããšã¯ãããªãã®è±èªãäžéãããè±èªã®ã¬ããŒããèªã¿ãããœããšãã®æ°èãèªãŸãªããããšã§ãã ãªãªãžãã«ãšæè¡ããã°ãèªãã§ãã ããã åãäŒç€ŸãLinkedinãFacebookãNetflixãéåžžã«é¢é£æ§ã®é«ããã®ãæžããŠãããšããŸãã ãããã®çºè¡šã¯ãã¹ãŠTwitterã§ãã€ã§ãèŠãããšãã§ããŸãã ãããŠãTwitterãGitHubã¯ãããããããªããææ°æ å ±ãææ¡ããããã³ããšã³ãã®äžçã§äœãèµ·ãã£ãŠããã®ããç解ããããã®äž»èŠãªãã®ã§ãã
ãã®ç¹ã§ç§ãæ¬åœã«æ°ã«å ¥ã£ãåŒçšã2ã€æããããšæããŸãã
ãã»ãšãã©ã®ã¢ã«ãŽãªãºã ã®åââé¡ã¯ãããŒã¿æ§é ãå€æŽããããšã§è§£æ±ºã§ããŸããã ããã¯ãRadioJSã®åé¡ã®1ã€ã§Andrei Sitnikãèšã£ããã®ã§ãã ãããŠããããªã®1ã€ã§ããå€åã¯ç§ãã¡ã®ä»äºã§ãããã€ãŸã å€åã¯ç§ãã¡ã®ä»äºã§ãã ããã¯Googleã®ãžã§ã€ã¯ãèšã£ãã
ããã§ãåŸæ¥ã®ã·ã³ã°ã«ããŒãžã¢ããªã±ãŒã·ã§ã³ãæŸæ£ããçç±ãšç§»åå ã«ã€ããŠã®è³ªåã«çããããšãé¡ã£ãŠããŸãã ããã¯å®éã«ã¯èŠãç®ã»ã©é£ããã¯ãªãã®ã§ããã®æ¹åã«é²ãã§ãã ããã
é£çµ¡å
» DenisIzmaylov
Github
» Twitter
ãã®ã¬ããŒãã¯ãç¹å¥ãªã»ã¯ã·ã§ã³ã ããã³ããšã³ã ããã©ãŒãã³ã¹ãã®é«è² è·ã·ã¹ãã HighLoad ++ã®éçºè ã®äŒè°ã§ã®æé«ã®ã¹ããŒãã®1ã€ã®ãã©ã³ã¹ã¯ãªããã§ãã
ãŸãããããã®è³æã®äžéšã¯ãé«è² è·ã·ã¹ãã HighLoadã®éçºã«é¢ãããªã³ã©ã€ã³ãã¬ãŒãã³ã°ã³ãŒã¹ã§äœ¿çšãããŸãã¬ã€ãã¯ãç¹å¥ã«éžæãããæåãèšäºãè³æããããªã®ãã§ãŒã³ã§ãã ç§ãã¡ã®æç§æžã«ã¯ãã§ã«30以äžã®ãŠããŒã¯ãªè³æããããŸãã æ¥ç¶ããŠãã ããïŒ
ããŠãäž»ãªãã¥ãŒã¹ã¯ã Frontend Confãå«ã8ã€ã®ã«ã³ãã¡ã¬ã³ã¹ãå«ãæ¥ç¥ãã Russian Internet Technologies ãã®æºåãå§ããããšã§ãã ããã¯ãè² è·ã®é«ãã·ã¹ãã ã®éçºè åãã®å°éçãªäŒè°ã§ãã ãšããã§ãããã¹ã¯åœŒå¥³ã®ããã°ã©ã å§å¡äŒã«å«ãŸããŠããŸãã