Info ãã®è¨äºã¯2023/02/25ç¾å¨ã®ãã®ã§ãããã¼ã¸ã§ã³å¤æ´ã«ããæ¹æ³ãå¤ãããã¨ãããã¾ãã ã¯ããã« Electronã¨ã¯ Electronã¯Webãµã¤ãã®è¨èªï¼JavaScriptãCSSãHTMLï¼ãå©ç¨ãã¦ããã«ããã©ãããã©ã¼ã ã¢ããªãéçºãããã¨ãã§ãããã¬ã¼ã ã¯ã¼ã¯ã§ããJavaScriptã®ç¥èããããã°ãC++ãC#ãªã©ã§ä½ããã¤ãã£ãã¢ããªã®ç¥èããªãã¦ããç°¡åã«ãã¹ã¯ãããã¢ããªãä½ããã¨ãã§ãã¾ãã Electron Forgeã¨ã¯ Electron Forgeã¯Electonã¢ããªã±ã¼ã·ã§ã³ãããã±ã¼ã¸åã»é å¸ããããã®ãªã¼ã«ã¤ã³ã¯ã³ãã¼ã«ã§ãã³ã¼ãç½²åãªã©ã¨ãã£ããã«ãå¦çãã¾ã¨ãã¦ããã¾ãã Electron Forgeã®ãã³ãã¬ã¼ããä½ã Electron Forgeã®ãã³ãã¬ã¼ããä½ãã¾ãã Webpackã¨TypeScriptã«å¯¾å¿ããããã
ã¯ããã« create-react-app(TypeScript)ã§çæããããã¸ã§ã¯ããElectronä¸ã§åä½/ããã±ã¼ã¸åã§ããç°å¢ãæ§ç¯ãã¾ãã åææ¡ä»¶ yarnã³ãã³ãã使ç¨ã§ããã㨠ãã®è¨äºã§ã§ããã㨠Electronä¸ã§Reactã®ãã¼ã¸ã®è¡¨ç¤º/ããã±ã¼ã¸å ã¡ã¤ã³ããã»ã¹ã¨ã¬ã³ãã©ã¼ããã»ã¹ã®æ¥ç¶ create-react-appã®ã¤ã³ã¹ãã¼ã«ã¨ããã¸ã§ã¯ãã®çæ $ yarn global add create-react-app $ yarn create react-app <ããã¸ã§ã¯ãå> --template typescript
Webéçºã®ç¥èããã®ã¾ã¾ãã¹ã¯ãããã¢ããªéçºã«ä½¿ããã¨ãããã¨ã§ãElectronãé¢ç½ããã ãªï½ã¨æã£ã¦ãã¾ãã jsã«æ £ãã¦ããæ¹ã§ããã°ç°å¢æ§ç¯ã«æ©ããã¨ã¯ãªãããã§ãããçè ã¯ReactãElectronãåå¿è ãªã®ã§ç°å¢æ§ç¯ã®æé ãã¡ã¢ãã¦ããã¾ã ç°å¢ OS: Windows 10 Home / 21H2 / 19044.2604 Node.js: v19.7.0 æé 1. Webpack + Typescriptã®ç°å¢ãä½ã npm init electron-app@latest my-app -- --template=webpack-typescript ãã®ç¶æ ã§npm startããã¨ã¢ããªã¯ãããªæã 2. tsconfig.json ã®compilerOptionsã« "jsx": "react-jsx"ã追å ãã # tsconfig.json { "c
Electronã¨ã¯ GitHubãéçºãããã¹ã¯ãããã¢ããªãä½ãããã®ãã¬ã¼ã ã¯ã¼ã¯ã HTML,CSS,JSã使ã£ã¦ãã¹ã¯ãããã¢ããªãä½ããã¨ãã§ããã®ã§ãããã³ãã¨ã³ãéçºçµé¨è ã¯ããç¨åº¦å®¹æã«éçºãã§ããã Electronã§ä½ããã代表çãªè£½åã¯VSCodeãSlackãªã©ãåç¥ã®ãµã¼ãã¹ã ä»çµã¿ Chromiumã¨Nodeãå é¨çã«ä½¿ç¨ããã¦ãããOSã®æä¾ããæ©è½ã«ã¤ãã¦ã¯Nodeã§ã³ã³ããã¼ã«ããä»çµã¿ã ã¢ããªå ã«ã¯ãã¡ã¤ã³ããã»ã¹ãã¨ãã¬ã³ãã©ã¼ããã»ã¹ãã®äºã¤ã®ããã»ã¹ãåå¨ãããã¡ã¤ã³ããã»ã¹ãã¯OSã¨ã®ããã¨ããªã©ãå¸ãNodeã«ãã£ã¦åä½ããé¨åããã¬ã³ãã©ããã»ã¹ãã¯å¾æ¥ã®webã¢ããªã¨åãã ä¾ãã°ãã¢ããªä¸ã®ã¦ã¼ã¶ã¼ã¤ãã³ãã«ãã£ã¦ãã¼ã«ã«ã®ãã¡ã¤ã«ãéãããå ´åããã¬ã³ãã©ã¼ããã»ã¹ããããã¡ã¤ã³ããã»ã¹ãã«éä¿¡(IPC)ãè¡ãããã¡ã¤ã³ããã»ã¹ã
Having spent a few days experimenting with setting up a build process for creating an Electron-based application thought I would put together a post describing the setup. First, a disclaimer that this is still a work in progress and as with everything within the JavaScript world it seems like there are a thousand ways to do it and this is just one way. Secondly, I am by no means an expert and this
2021/01/20 (æ´æ°æ¥: 2021/02/23) react+nginx+dockerç°å¢ã®æ§ç¯ docker React ãªãã§nginxã使ãã®ï¼ dockerã®reactç°å¢ã¯nodeã¤ã¡ã¼ã¸ã使ç¨ãã¦ä½æãã¾ãã nodeã«ã¯ãµã¼ãã¼æ©è½ãä»å±ãã¦ãããnpm startã§ãµã¼ãã¼ãç«ã¡ä¸ããã¾ãã ã§ããnode.jsãµã¼ãã¼ã¯ã·ã³ã°ã«ã¹ã¬ãããªã®ã§ãnginxã§ãªãã¼ã¹ãããã·ããã¦ãã«ãã¹ã¬ããã§ã¢ã¯ã»ã¹ãåãåããnode.jsãµã¼ãã¼ã«å¦çãæããäºã§è¤æ°ã¢ã¯ã»ã¹ããã°ããä»æ§ã«ãã¾ãã nodeãµã¼ãã¼ã¯ã·ã³ã°ã«ã¹ã¬ãããªã®ã§ãreactã§ã³ã³ãã¤ã«ããéçãã¡ã¤ã«ãnginxã«é ç½®ããäºã§ãã«ãã¹ã¬ããå¦çãå¯è½ã§ãã (reactã§ã³ã³ãã¤ã«ãã¦ãã¾ãã°ãjsã®éçãã¡ã¤ã«ã«ãªããµã¼ãã¼å¦çã¯ç¡ãã®ã§ããªãã¼ã¹ãããã·ã§ããã«æ¸¡ãå¿ è¦ã¯ãªãã¿ããã§ããã)
ãã®å ¥éã¯ã Reactã®æè¡è¦ç´ ãå§åçå¹çã§å¦ã¶ ãã¨ãç®çã«ãã¦ãã¾ãã Reactã®æè¡è¦ç´ ãæ£ãã°ããWebã¢ããªã1ããä½ã£ã¦ãããã¨ã§Reactãå¦ãã§ããã¾ãã ãã¹ã¦ã®åãã³ã¼ããå ¬éãã¦ãã¾ãã ç®æ¬¡ 1. Reactã®æ°è¦ããã¸ã§ã¯ãã®ç«ã¡ä¸ã âä»ãã 2. ã³ã³ãã¼ãã³ãã®æ¸ãæ¹ã¨ã¤ãã³ããã³ãã© 3.Class Components 㨠Function Components 4. æ¡ä»¶åå² (if) ã¨ç¹°ãè¿ã (loop) 5. ãã©ã¼ã ã¨è¦ªåéã®ãã¼ã¿ã®ããåã 6. ã³ã³ãã¼ãã³ãã®ã©ã¤ããµã¤ã¯ã« 7. ã¹ã¿ã¤ã« (æºåä¸) 8. Higher-Order Component (æºåä¸) 9. Portalãå©ç¨ããã¢ã¼ãã« (æºåä¸) 10. refã«ããã¨ã¬ã¡ã³ãã®åå¾ (æºåä¸) 11. Contextãå©ç¨ãããã¼ãã®å¤æ´ (æºåä¸) ãã®å ¥éã®
ããã«ã¡ã¯ãã¿ããã§ããReact + TypeScriptã§canvaså±æ§ãæ±ãããã£ãããgetContextãTypeScriptã®åã¨ã©ã¼ã«å¼ã£ããã£ã¦ãã¾ã解決ããã®ã«æéãããã£ã¦ãã¾ãã¾ããããªã®ã§ä»åã¯React + TypeScriptã§canvaså±æ§ãæ±ãããã®ãã³ãã¬ã¼ããæ®ãã¦ããã¾ãã ã³ã¼ãã®å ¨ä½å import React, {useEffect, useRef} from 'react'; function Canvas() { const canvasRef = useRef(null); const getContext = (): CanvasRenderingContext2D => { const canvas: any = canvasRef.current; return canvas.getContext('2d'); }; useEff
ã¯ããã« æ¬æ稿ã®èæ¯ã¨ç®ç Reactã®å ¬å¼ãã¥ã¼ããªã¢ã«ã¯å¤§å¤ããã§ãã¦ããã®ã§ãåå¦è ãReactã®åºæ¬ãå¦ã¶ããã«ã¯ãã¾ãã¯å ¬å¼ãã¥ã¼ããªã¢ã«ã«æ²¿ã£ã¦æãåããã¦ããã®ãä¸çªã ã¨æãã¾ãã ç§èªèº«ãå ¬å¼ãã¥ã¼ããªã¢ã«ããã£ã¦ã¿ã¦åºæ¬çãªé¨åã®ç解ã¯ã§ãããã®ã®ã以ä¸ã®ç¹ãèªåã«ã¨ã£ã¦ã¯èª²é¡ã«æãã¾ããã TypeScriptã§æ¸ãããå ´åã«ã©ãããã°ãããåãããããããã調ã¹ãå¿ è¦ããã£ã ä¸ç®ä¸¦ã¹ã¨ããé¡æãè¥å¹²ããªããã¼ã«æãã ã¨ããããã§ãTypeScriptã使ã£ã¦Reactã«å ¥éããããã®ãããã·ã³ãã«ãªé¡æã®ãã¥ã¼ããªã¢ã«ãä½æãããã¨ãæ¬æ稿ã®ç®çã§ãã ç§èªèº«ãåå¦è ãªã®ã§ãåå¦è ç®ç·ã§ã®èª¬æãå¿ããã¦ãã¾ããããããã«ããç®æãééã£ã¦ããç®æãªã©ããã¾ãããå¿æã®ãªãã³ã¡ã³ããé ããã¨æãé£ãã§ãã ï¼2020-09-22追è¨ï¼ TypeScriptã§Rea
SPAã®ãã°ã¤ã³èªè¨¼ã®ãã¹ããã©ã¯ãã£ã¹ãããããªãã£ãã®ã§ããã¨ç¶²ç¾ çã«ç 究ãã¦ã¿ããJWT or Session ã©ã£ã¡ï¼ãJavaScriptRailsJWTèªè¨¼React SPAã®ãã°ã¤ã³å¨ãã«ã¤ãã¦ããããããã¹ããã©ã¯ãã£ã¹ã ï¼ãã¨ããæ å ±ããã¾ãè¦å½ãããªãã®ã§ãæ§ã ãªå¯è½æ§ã模索ãã¦ã¿ã¾ããã ãããããªç¶æ³ãæ³å®ãããä»åè¨è¼ããå 容ã«èæ ®ã®æ¼ããä¸åãªã©ãããã¾ãããæ¯éã³ã¡ã³ãã§ãææããã ãããã§ãï¼ç¹ã«ããããã度ï¼âãã¨è¨è¼ãã¦ãããã®ã«å¯¾ãã¦ã®æ¹å¤ãã©ãã©ããå¾ ã¡ãã¦ããã¾ãï¼ ãã®è¨äºã§ãããããã¦ãããã®ã§ãã£ã¦ãããèªèº«ã®è²¬ä»»ã§ååãªæ¤è¨ã»æ¤è¨¼ã®ä¸ã§é¸æããã¦ãã ããã åæ æ³å®ãã¦ããAPIã¯ã ãã°ã¤ã³å¤ã®APIã«ã¯POST/PUT/DELETEã®ãã®ããªããGETã®ã¿ GETã®APIã«ã¯DBãæ´æ°ãããªã©ã®æä½ããªã ã¨ãããã®ãããã°ã¤ã³å¤ã§ã¯
ç®ç ããããã½ããå ¥ãã¦ç°å¢æ§ç¯ãã¦ããã¨ãããããããªããªã£ã¦ããã Dockerã«è¨å®å ¨é¨æ¸ãã¦ç°¡åã«æ§ç¯ã§ããããã«ããã Pythonã§ããããå¦çãããã®ããã¼ã¿ãã¼ã¹ã«ä¿åãããã Pandasã§MariaDBã«æ¥ç¶ãããã ããã³ãã¨ã³ãã¯Reactã使ãããã Webpack + Babelãå°å ¥ããã Webãµã¼ãã¼ã¯ã©ãããï¼ æè¿æµè¡ã®Nginxã使ããã Dockerã®å°å ¥ã¾ã§ GCPã§CentOS7ã®ã¤ã³ã¹ã¿ã³ã¹ãä½æããã dockerã¨docker-composeãã¤ã³ã¹ãã¼ã«ããã dockerããµã¼ãã¹ã«ç»é²ããsudoãªãã§dockerã³ãã³ããå®è¡ã§ããããã«ããã sudo yum install -y yum-utils device-mapper-persistent-data lvm2 && \ sudo yum-config-manager
Reactã¯ã³ã³ãã¼ãã³ããçµã¿åããã¦éçºãè¡ããã¨ã§ãä¿å®æ§ã®é«ãã¢ããªã±ã¼ã·ã§ã³ãå®ç¾ã§ããã©ã¤ãã©ãªã§ããåæã«ãåªããUIãæä¾ããã©ã¤ãã©ãªã§ãããã¾ããä»åã¯ã©ã¤ãã©ãªãReact Routerããå©ç¨ãã¦ãGUIã¢ããªã±ã¼ã·ã§ã³ã«ã¯æ¬ ãããªãç»é¢é·ç§»ã¨URLã®ç®¡çãè¡ãæ¹æ³ãå¦ã³ã¾ãããã 対象èªè JavaScriptã¨Webéçºã®åºç¤ã«ç解ãããæ¹ Reactã«èå³ï¼é¢å¿ããããããããå¦ã³å§ããæ¹ åæç°å¢ çè ã®æ¤è¨¼ç°å¢ã¯ä»¥ä¸ã®éãã§ãã macOS Sierra 10.12 Node.js v8.9.3ï¼npm 5.5.1 React 16.1.1 react-router-dom 4.2.2 ç»é¢é·ç§»ã¨Reactã¨URL GUIã¢ããªã±ã¼ã·ã§ã³ãå¤ãã®æ©è½ãæã¤ããã«æ¬ ãããã¨ãã§ããªãæ©è½ã®ã²ã¨ã¤ã¨ãã¦ãç»é¢é·ç§»ãããã¾ããå³1ã¯ãã¼ã¸ã2ã¤æã¤Webãµã¤ãã®
ã¯ããã« ä»äºã§Railsã使ç¨ãã¦éçºããã¦ããã®ã§ãããäºæ ã«ããReactãå°å ¥ãããã¨ã«ãªãã¾ããã ãããããReactã£ã¦ä½ï¼ãç¶æ ã®èªåã«ã¨ã£ã¦ããããªãReactãå°å ¥ã¨è¨ããã¦ã... ãªã®ã§ãäºåã«Reactãåå¼·ãããããè²ã åèã«ããªãããç°¡åãªãµã³ãã«ãä½ã£ã¦ã¿ã¾ããã 使ç¨ããæè¡ã¨ãã¼ã¸ã§ã³ ruby 2.5.1 Rails 5.2.2 react-rails 2.4.7 WebPacker 3.5.5 åèã«ããè¨äºãæ¸ç± Reactã®å¦ç¿ã«ã¯ããã¡ãã®æ¸ç±ã使ç¨ãã¾ããã ä»åè¨è¿°ãããµã³ãã«ã³ã¼ããããã¡ãã®å 容ã大ãã«åèã«ããã¦é ãã¤ã¤ãè¨è¿°ãã¦ããã¾ããã åç°è£ç¾ èãä½ããªããå¦ã¶ Reactå ¥éã(2017) https://www.amazon.co.jp/%E4%BD%9C%E3%82%8A%E3%81%AA%E3%81%8C%E3%82
JSXã®äºå§ã Reactãåå¼·ãå§ãã« ãJSXã¨ã¯ãªãããã ã¨ããã®ãç解ããã¨ã ããªãã¨ãªãHtml風ã«æ¸ããJavaScriptã®æ¡å¼µæ§æã ã¨ç解ãã¦ãã人ãå¤ãã¨æãã ãã ãJSXã¯JavaScriptã«å¤æãããã ã¨ããã®ãã©ããã§åå¼·ããªãã¨éä¸ã§ã¤ã¾ã¥ãã®ã§ãJSXã«ã¤ãã¦ã®ç解ãããå°ãæ·±ããå¿ è¦ãããã JSXã¯JavaScriptã«å¤æããã babelã®å¤æçµæãè¦ãã°ä¸çºãªã®ã ãã©ãJSXãæ¸ãã¦ããã¨ããbabelã§ã¯æ¬¡ã®ããã«å¤æãã¦ããã®ã ã¨ãããã¨ãç解ãã¦ããå¿ è¦ããããã ãã©ãããã«ã¤ãã¦è§£èª¬ãã¦ãããã®ããã¾ããªãã ä¾ãã°æ¬¡ã®ã³ã¼ã
React ã«ããã¢ããªã±ã¼ã·ã§ã³éçºã®å ¥éãµã¤ã React ã¯ã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãéçºããããã® JavaScript ã©ã¤ãã©ãªã§ã ãã§ã¤ã¹ããã¯ãã¤ã³ã¹ã¿ã°ã©ã ãä¸å¿ã¨ãªãéçºã»ã¡ã³ããã³ã¹ãè¡ããã¦ãã¾ãã Google ã® Angular çã¨åãããã«ããããã SPA (ã·ã³ã°ã«ãã¼ã¸ã¢ããªã±ã¼ã·ã§ã³) ãéçºããã®ã«åãã¦ãã¾ãã ã¾ããReact ã¨åæ§ã®ã³ã³ã»ããã§ãã¤ãã£ãã¢ãã¤ã«ã¢ããªã±ã¼ã·ã§ã³ãéçºããããã®ã React Native ãããã¾ãã è¨è¨ææ³ã¨ã㦠"lean once, write anywhere" (ã²ã¨ãã³å¦ã³ãã©ãã§ãæ¸ãã) ã¢ããã¼ãã¨è¨ããã¦ãã¦ã ã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãæ¸ããã®ãã¨ããAndroid åããiOS åããªã©ã®ãã¤ãã£ãã®ã³ã¼ããæ¸ãã¾ãã ç¹å®ã®ãã©ãããã©ã¼ã ã«åãã¦ã³ã¼ããæ¸ãå ´åã¯ãã®ç°å¢ã«æé©å
React è¦ç´ ãç°¡åã«è¨è¿°ãã JSX ããã¾ã§ã®ä¾ã§ã¯ React è¦ç´ ãä½æããããã«ã React API ã® React.createElement() ãå©ç¨ãã¦ãã¾ããã ããããJSX ã使ã㨠React è¦ç´ ããã簡便ãªå½¢å¼ã§ä½æã§ãã¾ãã JSX 㯠JavaScript ãæ¡å¼µãã¦ãUI è¦ç´ ãè¨è¿°ããã®ã« HTML ã®ãããªã¿ã°æ§æã使ããããã«ãããã®ã§ãã JSX ã«ãã React è¦ç´ ã®ä½æ æ¯è¼ã®ãããã¾ã㯠JSX ã使ããªã㧠React è¦ç´ ãä½æããä¾ã示ãã¾ããããã¯ãReact ã®åºæ¬è¦ç´ ã React è¦ç´ 㨠ReactDOMãã§ç´¹ä»ããä¾ã¨åãã§ãã <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Simple React</title> </head> <bo
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}