2020-05-01ãã1ã¶æéã®è¨äºä¸è¦§
state ãæ±ã£ã¦ããã¨é åã®æä½ãããæ©ä¼ãå¤ãã®ã§ããé åããå¤ãåãåºãæã® slice 㨠splice ä¼¼ã¦ãã Array.prototype.slice arr.slice([begin[, end]]) slice ã¯åãåºãä½ç½® (begin) ããçµäºä½ç½® (end) ã¾ã§ã®è¦ç´ ãåãåºãã æ»ãå¤ã¯åãåºãâ¦
setTimeout ãåæçã«ä½¿ãããå ´åãsetTimeout 㯠Promise ãè¿ããªãã®ã§ async / await ã使ã£ã¦å¼ã³åºãããå ´å㯠Promise ãè¿ãé¢æ°ã«ãã¦ããã°OK Promise ãè¿ãå é¨ã§ setTimeout ããé¢æ°ã«ããã°OK const sleep = (callback, delay = 1000) => â¦
React 㧠form ãä½ã£ã¦ããã次ã®ãã㪠Warning ãçºçãã¾ããã Warning: A component is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide â¦
create-react-app, react-script ã§ä½ããã React application ã¯å é¨ã§ dotenv ã使ããã¦ãã¦ã.env ã§è¨å®ããå¤ã«ã¯ãprocess.env çµç±ã§ã¢ã¯ã»ã¹ãã§ããã ãã ãå¤ã«ã¯REACT_APP_ ã®ãã¬ãã£ãã¯ã¹ãå¿ è¦ REACT_APP_ ããå§ã¾ããªãå¤ã¯ React appliâ¦
export default Foo ãããã¢ã¸ã¥ã¼ã«ã as ã使ã£ã¦ import ãããã¨ãã®ã¡ã¢ export default ããããªãã¸ã§ã¯ãåãæå®ããã¨ã¨ã©ã¼ã«ãªã export ã®å ´åã¯åé¡ãªãããexport default ã®å ´åã¯ã¨ã©ã¼ã«ãªã export // components/Cunter.js export funâ¦
delete ã¡ã½ããã¨ã㧠Array.filter ã¿ãããªæãã§ã state ã®ä¸ããç¹å®ã®ããããã£ãåé¤ãã¦æ°ãããªãã¸ã§ã¯ããè¿ãããã 1. Object.assign() 㧠ãªãã¸ã§ã¯ããã³ãã¼ã㦠delete JavaScript ã® delete æ¼ç®åã¯ç ´å£çãªã®ã§ã Object.assign() ã§â¦
React ã® useReducer ã使ãã¨ã action ãã¨ã®å¦çãåããã®ã« switch æã使ããã¨ãå¤ãã§ãããè¤æ°ã® case å ã§åãååã®å¤æ°ã使ãããæ const ã§å®ç¾©ããã¨ããã£ã¦ãã¾ããã¨ãããã¾ãã case å ã§åãååã®å¤æ°ã const ã§å®ç¾©ããã¨ã¨ã©ã¼ã«â¦
Debounce ã§å¤ãåæ ãããã³ã³ãã¼ãã³ããä½ã£ã¦ãã¦ãsetTimeout å 㧠event ãã渡ããã event.target ã使ããã¨ããã null ã«ãªã£ã¦ãã¦ã¨ã©ã¼ã«ãªãããªãããããã⦠ã«ãªã£ã¦ããã£ã¦ããã®ã§ã¡ã¢ event.target ã null ã«ãªãã³ã¼ã useDebounceâ¦
éç¨ãã¦ãã blog ã«ãªã³ã¯åãã®ãã®ãããããããã®ã§ããªã¹ãã¢ãããã¦æ¬²ããã¨ããä¾é ¼ãåãã¦ãã£ã¦ã¿ãç¥è¦ã®ã¡ã¢ æ¹é è¨äº URL ããè¨äºå 容ãåå¾ è¨äºå ãã a ã¿ã°ãåå¾ a ã¿ã°ã® ãªã³ã¯å ã«ã¢ã¯ã»ã¹ãã¦ãªã³ã¯åãã«ãªã£ã¦ãããã®ããã¡ã¤â¦