{"id":167448,"date":"2020-10-14T22:49:54","date_gmt":"2020-10-14T14:49:54","guid":{"rendered":"http:\/\/4563.org\/?p=167448"},"modified":"2020-10-14T22:49:54","modified_gmt":"2020-10-14T14:49:54","slug":"%e6%90%9e%e4%b8%8d%e6%98%8e%e7%99%bd-react-hooks%ef%bc%8c%e6%9c%89%e6%b2%a1%e6%9c%89%e5%85%84%e5%bc%9f%e5%88%86%e4%ba%ab%e4%b8%80%e4%b8%8b%e7%bb%8f%e9%aa%8c%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=167448","title":{"rendered":"\u641e\u4e0d\u660e\u767d React Hooks\uff0c\u6709\u6ca1\u6709\u5144\u5f1f\u5206\u4eab\u4e00\u4e0b\u7ecf\u9a8c\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u641e\u4e0d\u660e\u767d React Hooks\uff0c\u6709\u6ca1\u6709\u5144\u5f1f\u5206\u4eab\u4e00\u4e0b\u7ecf\u9a8c\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yazoox <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u516c\u53f8\u4ea7\u54c1\u4e00\u76f4\u7528\u7684\u662f react-redux \u505a\u72b6\u6001\u7ba1\u7406\uff0c\u7528 saga \u5904\u7406\u5f02\u6b65\u3002<\/p>\n<p>\u5347\u7ea7\u5230\u4e86 16.8\uff0c\u542c\u8bf4\u6709\u4e2a hooks\uff0c\u5f88\u65b9\u4fbf\u3002<\/p>\n<p>\u770b\u4e86\u5b98\u65b9\u6587\u6863\uff0c\u4e5f\u641c\u7d22\u4e86\u4e00\u4e0b\uff0c\u8fd8\u662f\u641e\u5f97\u4e0d\u662f\u5f88\u660e\u767d\u3002<\/p>\n<p>\u5927\u5bb6\u6709\u6ca1\u6709\u770b\u5230\u6bd4\u8f83\u597d\u7684\u6587\u6863 \/\u6587\u7ae0\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u5206\u4eab\u8fd9\u4e2a react hooks \u7684\uff1f\u6c42\u5206\u4eab\u6307\u70b9\u3002\u8c22\u8c22\u3002<\/p>\n<p>\u53e6\uff0c\u8fd9\u4e2a hooks \u6bd4 redux \u597d\u7528\u4e48\uff1f\u80fd\u591f\u53d6\u4ee3 redux &amp; saga \u4e48\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>31<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3712316\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jianzhang810 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u770b\u4e0b\u8fd9\u7bc7\u6587\u7ae0 https:\/\/juejin.im\/post\/6844903709927800846                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712317\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : VDimos <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a8\u8350\u4e2a lib\uff0creact-uses\uff0c\u770b\u4e0b\u4f1a\u5bf9 hooks \u6709\u66f4\u6df1\u7684\u7406\u89e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712318\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : easonHHH <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hook \u662f\u53d6\u4ee3 class \u7684\u5427\uff0c\u4e24\u8005\u5e94\u8be5\u4f1a\u957f\u671f\u5171\u5b58\u4e00\u6bb5\u65f6\u95f4\uff0c\u4e0d\u8fc7\u6709 useReducer<br \/>\u5012\u662f\u5b98\u65b9\u51fa\u4e86\u4e00\u4e2a\u5bf9\u6807 redux \u7684 recoil                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712319\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : azcvcza <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             usehooks.com                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712320\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hook \u548c class \u662f\u4e24\u79cd\u5199\u6cd5\uff0c\u601d\u8def\u662f\u6709\u53d8\u5316\u7684\uff0c\u6211\u8ba4\u4e3a hook \u672c\u8d28\u4e0a\u89e3\u51b3\u7684\u662f react api \u53c8\u957f\u53c8\u81ed\u7684\u95ee\u9898\uff0c\u4e0d\u662f\u8bf4 hook \u5c31\u6bd4 class \u4f18\u8d8a\uff0c\u8be5\u8bbe\u8ba1\u4e00\u6837\u5f97\u8bbe\u8ba1\uff0c\u4ee5\u524d\u8003\u8651\u751f\u547d\u5468\u671f\uff0c\u73b0\u5728\u76f4\u63a5\u8003\u8651\u53d8\u91cf\uff0c\u8be5\u4f18\u5316\u8fd8\u662f\u5f97\u4f18\u5316\uff0c\u8be5\u4e0d\u7ba1\u8fd8\u662f\u53ef\u4ee5\u4e0d\u7ba1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712321\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gouflv <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             redux \u89e3\u51b3\u7684\u662f\u72b6\u6001\u7ba1\u7406\u548c\u5171\u4eab\uff0c\u800c hooks \u53ea\u662f\u72b6\u6001\u7ba1\u7406\uff0c\u4e0d\u6d89\u53ca\u5982\u4f55\u5171\u4eab\u6570\u636e\uff0c\u6240\u4ee5\u4f60\u8bf4\u600e\u4e48\u53d6\u4ee3\uff1f<br \/>\u770b\u6587\u7ae0\u81ea\u5df1\u8981\u52a8\u8111\uff0c\u4e00\u77e5\u534a\u89e3\u7684\u65f6\u5019\u4e0d\u8981\u778e\u5e7b\u60f3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712322\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wee911 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gouflv hooks \u7ec4\u5408\u80fd\u89e3\u51b3\u5171\u4eab\u95ee\u9898\uff0c \u591a\u6570\u573a\u666f\u6ca1\u6709\u7528 redux \u5fc5\u8981\uff0chooks \u4e00\u5957\u5e26\u8d70                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712323\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Wolther47 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u662f\u4e24\u4e2a\u4e1c\u897f\uff0c\u5c51\u5c51\u3002<\/p>\n<p>Hooks \u4ecb\u7ecd\u6587\u6863\u91cc\u9762\u5c31\u6709\u5f53\u65f6 Conf \u7684\u89c6\u9891\uff0c\u5efa\u8bae\u770b\u4e00\u904d\uff0c\u4e24\u6bb5\u90fd\u662f\u5173\u4e8e migrating from class components to hooks \u7684\uff0c\u770b\u5b8c\u5c31\u77e5\u9053 useState \u3001useEffect \u548c useContext \u4e86\uff0c\u57fa\u672c\u53ef\u4ee5\u642c\u7816\u4e86                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712324\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KuroNekoFan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5176\u5b9e hooks \u6709\u70b9\u50cf vue \u7684 mixin\uff0c\u5f53\u7136\uff0c\u597d\u5f88\u591a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712325\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KuroNekoFan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u5b9a\u4e49 hook \u548c react \u539f\u672c\u63d0\u4f9b\u7684 hooks \u5e94\u8be5\u533a\u5206\u6765\u770b\u5f85\uff0c\u81ea\u5b9a\u4e49 hook \u53ef\u4ee5\u770b\u4f5c\u4e00\u6bb5\u903b\u8f91\uff0c\u800c react \u672c\u8eab\u63d0\u4f9b\u7684 hooks \u662f\u4e3a\u4e86\u89e3\u51b3\u526f\u4f5c\u7528\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712326\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yaphets666 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @KuroNekoFan \u8fd9\u4fe9\u4e1c\u897f\u6ca1\u4ec0\u4e48\u76f8\u4f3c\u4e4b\u5904\u5427&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712327\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Wolther47 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gouflv #5 Hooks \u4e0d\u662f\u4e3a\u4e86\u89e3\u51b3\u72b6\u6001\u7ba1\u7406\u7684\u3002\u8fd9\u4e1c\u897f\u7eaf\u7cb9\u5c31\u662f\u5f53\u65f6\u5f80 Class Component \u8d70\u7684\u65b9\u5411\u9519\u4e86\uff0c\u518d\u5f15\u5165\u7684\u6539\u8fdb\u529e\u6cd5\u3002Hooks \u4e3b\u8981\u76ee\u7684\u662f\u89e3\u51b3\u903b\u8f91\u590d\u7528\u548c\u4e1a\u52a1\u903b\u8f91\u5206\u88c2\u7684\uff0cVue \u90a3\u96be\u4ea7\u4e86\u51e0\u5e74\u7684 3 \u4e5f\u5728\u60f3\u529e\u6cd5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712328\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nanyang24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a2\u7d22\u6709\u5173 Algebraic Effects \u7684\u6982\u5ff5\uff0c\u5e94\u8be5\u4f1a\u6709\u542f\u53d1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712329\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codelegant <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f5c\u8005\u672c\u4eba\u4eb2\u81ea\u8bb2\u89e3\uff1a https:\/\/overreacted.io\/zh-hans\/a-complete-guide-to-useeffect\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712330\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Hanggi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hooks \u6838\u5fc3\u601d\u60f3\u5c31\u662f\u53bb\u6389 class \u6240\u6709\u4e1c\u897f\u90fd\u7528 function \u66ff\u4ee3.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712331\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codelegant <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9644\u4e0a\u4f5c\u8005\u7684 Github \u4e3b\u9875 https:\/\/github.com\/gaearon                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712332\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gouflv <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             redux \u5c31\u7b97\u5bf9\u6807\uff0c\u4e5f\u662f\u5e94\u8be5\u548c unstated \u548c constate \u8fd9\u4e9b\u53bb\u5bf9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712333\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KuroNekoFan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yaphets666 \u81ea\u5b9a\u4e49 hooks \u662f\u4e3a\u4e86\u903b\u8f91\u590d\u7528\uff0cmixin \u4e5f\u662f\u4e3a\u4e86\u903b\u8f91\u590d\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712334\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cityboy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ee5\u524d\u7528 react-redux \u5171\u4eab\u5168\u5c40\u53d8\u91cf\u3002hooks \u91cc\u9762\u5efa\u8bae\u7528 useContext \u8fd9\u79cd\uff0c\u4f46\u662f\u6211\u4e00\u76f4\u4e0d\u4f1a\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u800c\u4e14\u7528\u7740\u611f\u89c9\u5f88\u9ebb\u70e6\u3002\u5404\u4f4d\u5927\u4f6c\u6709\u6700\u4f73\u5b9e\u8df5\uff0c\u53ef\u4ee5\u8ba9\u5c0f\u5f1f\u89c2\u6469\u89c2\u6469                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712335\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KuroNekoFan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cityboy \u63a5\u7740\u7528 react-redux \u6ca1\u6bdb\u75c5\uff0c\u53ef\u4ee5\u770b\u770b react-redux \u65b0\u63d0\u4f9b\u7684 api\uff1auseDispatch \u548c useSelector                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712336\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Torpedo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hook \u5148\u5b66\u4e60\u57fa\u672c\u7684 hook \u6982\u5ff5\u3002<br \/>\u7136\u540e\u5c31\u662f\u5c01\u88c5 hook \u590d\u7528\u3002<br \/>\u4e4b\u524d\u51fd\u6570\u63a8\u8350\u7eaf\u7ec4\u4ef6\uff0c\u4f60\u53ef\u4ee5\u8fd9\u4e48\u5199\uff1a\u4e00\u79cd\u51fd\u6570\u7ec4\u4ef6\u6709 hook\uff0c\u8d1f\u8d23\u903b\u8f91\u4ec0\u4e48\u7684\uff1b\u4e00\u79cd\u51fd\u6570\u8fd8\u662f\u7eaf\u7ec4\u4ef6\uff0c\u6ca1\u6709 hook \u548c\u72b6\u6001\u3002<\/p>\n<p>\u5728 hook \u4e4b\u524d\uff0c\u590d\u7528\u90fd\u662f\u7528\u9ad8\u9636\u7ec4\u4ef6\u3002\u4f46\u662f\u9ad8\u9636\u7ec4\u4ef6\u4e0d\u80fd\u5f88\u597d\u7684\u63a7\u5236\u987a\u5e8f\uff0c\u4e92\u76f8\u4e4b\u95f4\u7ec4\u5408\u633a\u9ebb\u70e6\u7684\u3002\u4f46\u662f hook \u4e4b\u95f4\u7ec4\u5408\u5f88\u65b9\u4fbf\uff0c\u4e5f\u5bb9\u6613\u590d\u7528\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712337\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Torpedo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cityboy useContext \u8fd9\u79cd\u4e3b\u8981\u7528\u6765\u5171\u4eab\u4e00\u4e9b\u53d8\u91cf\u5427\u3002react-redux \u4e5f\u662f\u7528\u7684\u8fd9\u4e2a\u3002\u53ea\u4e0d\u8fc7\u4e00\u822c\u4f7f\u7528\u7684\u65f6\u5019\uff0ccontext \u91cc\u53d8\u91cf\u90fd\u662f\u7528\u6765\u5b58\u72b6\u6001\u7684\uff0c\u8fd9\u6837\u72b6\u6001\u53d8\u91cf\uff0cuseContext \u90fd\u4f1a\u53d8\u3002<br \/>\u4f46\u662f react-redux \u7528\u7684\u662f\u4e00\u4e2a\u72b6\u6001\u5f15\u7528\uff0c\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\uff0c\u4fdd\u8bc1\u53ea\u66f4\u65b0 selector \u9009\u4e2d\u7684\u72b6\u6001\u90e8\u5206                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712338\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ghosthcp516 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u53ef\u4ee5\u7406\u89e3\u6210\u51fd\u6570\u5185\u7684 import \/ export                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712339\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : stabc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gouflv LZ \u4e0d\u5c31\u662f\u5728\u6c42\u6559\u5417\u3002\u8fd9\u79cd\u865a\u5fc3\u7684\u6001\u5ea6\u4f60\u4e5f\u80fd\u55b7\uff1f\u800c\u4e14\u4f60\u81ea\u5df1\u7684\u7406\u89e3\u4e5f\u4e0d\u548b\u5730\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712340\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dartabe <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u81ea\u5df1\u5728\u5199\u5b8c Redux \u4e4b\u540e \u53c8\u7528 Hook \u5305\u4e86\u4e00\u5c42 \u8fd9\u6837\u5728\u5176\u4ed6\u6a21\u5757\u91cc\u9762\u8981\u7528\u7684\u8bdd \u5c31\u66f4\u65b9\u4fbf\u4e86<\/p>\n<p>\u4e5f\u662f\u7f51\u4e0a\u770b\u6765\u7684 \u4e0d\u77e5\u9053\u7b97\u4e0d\u7b97\u6700\u4f73\u5b9e\u8df5<\/p>\n<p>https:\/\/github.com\/zjusticy\/flashCards\/blob\/master\/src\/hooks\/useAuth.ts                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712341\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : agdhole <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6240\u4ee5\u53c8\u8981\u72b6\u6001\u7ba1\u7406\u53c8\u8981\u6570\u636e\u5171\u4eab\uff0c\u5e94\u8be5\u7528\u4ec0\u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712342\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cityboy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @KuroNekoFan redux \u90a3\u4e00\u5957\u4e1c\u897f\u5199\u8d77\u6765\u592a\u5197\u4f59\u4e86\uff0c\u6211\u770b antd pro v5 \u7684\u5171\u4eab\u53d8\u91cf\u65b9\u5f0f\u4e0d\u9519\uff0c\u4f46\u662f\u4e0d\u77e5\u9053\u81ea\u5df1\u600e\u4e48\u5b9e\u73b0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712343\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lemon6 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hooks \u4ee3\u7801\u91cf\u5c11\uff0cclass \u4ee3\u7801\u7ed3\u6784\u6e05\u6670\u3002\u4ec5\u6b64\u800c\u5df2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712344\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imjamespond <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hooks \u6ca1\u6cd5\u5b9e\u73b0 componentshouldupdate,\u7684 prevouspros \u548c state\uff0c\u53ea\u662f\u7b80\u5355\u5bf9\u6bd4\uff0c\u800c\u4e14 useeffect \u7bad\u5934 func \u4e2d\u5305\u62ec\u7684 props \u8981\u5199\u5230\u7b2c\u4e8c\u53d8\u91cf\u6570\u7ec4\u76d1\u89c6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712345\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : namelosw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7ee7\u7eed Redux \u628a\uff0c\u53ea\u4e0d\u8fc7\u53ef\u4ee5 useReducer + useContext\uff0c\u800c\u4e0d\u518d\u7528 ReactRedux \u4e86<\/p>\n<p>\u7eaf hooks \u7528 useState \u66ff\u4ee3 useReducer \u5f88\u96be\u3002\u7b80\u5355\u7684\u60c5\u51b5\u7528 useState \u7684 setter \u5c31\u591f\u4e86\u8fd8\u884c\uff0c\u5982\u679c\u8fd8\u8981\u6709\u903b\u8f91\u62bd\u65b9\u6cd5\u5565\u7684\u8c03 setter \u7684\u8bdd\uff0c\u8981\u52a0\u7684 useMemo \u548c useCallback \u592a\u591a\u4e86\uff0c\u6700\u540e\u4e00\u76f4\u5728\u5199\u6ca1\u7528\u7684 useMemo \u548c useCallback\uff0c\u8fd8\u8bb0\u4e0d\u4f4f\u8981\u5199\u54ea\u4e9b\uff0c\u800c useReducer \u7684 dispatch \u4e0d\u4f1a\u5bfc\u81f4\u91cd\u7ed8\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3712346\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KuroNekoFan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cityboy \u4e00\u5806 reducer\uff0caction \u5b9a\u4e49\u6587\u4ef6\u4ec0\u4e48\u7684\u662f\u633a\u5197\u4f59\u7684\uff0c\u4f46\u662f\u6211\u89c9\u5f97\u6ca1\u5fc5\u8981\u90a3\u6837\uff0c\u6211\u4e00\u822c\u4e00\u4e2a store \u5c31\u5b8c\u4e8b\u4e86\uff0c\u5f53\u7136\uff0c\u72b6\u6001\u63d0\u5347\u8981\u8c28\u614e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u641e\u4e0d\u660e\u767d React Hooks\uff0c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167448"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167448"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167448\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167448"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}