èª²é¡ redux ãå¼ã£å¼µãåºãã¨å¤§ä»°ã«ãªããContext ä¸ã«å ±æã¹ãã¼ããæã£ã¦ããã« setState ã§ããã ãã§ããã ãªã®ã§ã次㮠2 ã¤ãç¨æãã ç¾å¨ã® state ãåç §ãã const appState = useAppState() ç¾å¨ã® state ãæ´æ°ããé¢æ°ãè¿ã const setAppState = useSetAppState() React.useState() ã¨éã£ã¦åå²ãã¦ããçç±ã¯ã主ã«ããã©ã¼ãã³ã¹ä¸ã®çç± å¤§åãªåç §ãªã®ã§ãå¯è½ãªéãã¹ãã¼ããåç §ããããªã setState() ã® API 㯠(prevState: State) => State ãåããã®ã§ãç¶æ æ´æ°ç¨éã«éã£ã¦ã¯ãããã useAppState() ããã«æ¸ããã¨ãå¤ã ã§ãæ¯åæ¸ãã¦ããã©ãã¤ã©ã¼ãã¬ã¼ãæå¼·ãä¸ã«å¿ããã®ã§ããã«ã¡ã¢ãã æ¯åæ¸ãã¦ããã¤ã©ã¼
{{#tags}}- {{label}}
{{/tags}}