{"id":53685,"date":"2024-12-03T17:03:18","date_gmt":"2024-12-03T09:03:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53685\/"},"modified":"2024-12-03T17:03:18","modified_gmt":"2024-12-03T09:03:18","slug":"%e7%94%a8%e4%ba%8e%e7%8e%b0%e4%bb%a3-web-%e5%bc%80%e5%8f%91%e7%9a%84%e5%ae%9e%e7%94%a8-react-%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53685\/","title":{"rendered":"\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93\u300b<\/span>\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span><\/span>\uff0c\u5982\u679c\u4f60\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241203\/1733220925674eda3d0c62a.jpg\" class=\"aligncenter\" title=\"\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93\u63d2\u56fe\" alt=\"\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93\u63d2\u56fe\" \/><\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5c06\u8ba8\u8bba\u60a8\u53ef\u4ee5\u5728 <strong>React<\/strong> \u9879\u76ee\u4e2d\u4f7f\u7528\u7684<strong>\u5e93<\/strong>\u3002<\/p>\n<p>\u5982\u679c\u4f60\u559c\u6b22\u6211\u7684\u6587\u7ae0\uff0c\u53ef\u4ee5\u8bf7\u6211\u4e00\u676f\u5496\u5561:)<br \/> \u7ed9\u6211\u4e70\u5496\u5561<\/p>\n<hr>\n<h2> 1. \u6837\u5f0f\u7ec4\u4ef6 <\/h2>\n<p>\u5b83\u662f\u4e00\u4e2a\u4f7f CSS \u5728 React \u5e94\u7528\u7a0b\u5e8f\u4e2d\u57fa\u4e8e\u7ec4\u4ef6\u7f16\u5199\u7684\u5e93\u3002\u7531\u4e8e\u5b83\u5177\u6709<strong>\u57fa\u4e8e\u7ec4\u4ef6\u7684\u7ed3\u6784<\/strong>\uff0c\u56e0\u6b64\u5b83\u5141\u8bb8\u60a8\u4ee5\u6a21\u5757\u5316\u65b9\u5f0f\u5355\u72ec\u8bbe\u7f6e\u6bcf\u4e2a\u7ec4\u4ef6\u7684\u6837\u5f0f\u3002\u5b83\u8fd8\u63d0\u4f9b<strong>\u52a8\u6001\u6837\u5f0f\u548c\u4e3b\u9898\u4e4b\u95f4\u7684\u5207\u6362<\/strong>\u7b49\u529f\u80fd\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u7684\u6837\u5f0f\u7ec4\u4ef6<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u6837\u5f0f\u7ec4\u4ef6<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 2.\u798f\u7c73\u514b\u2014\u2014\u662f\u7684 <\/h2>\n<p><strong>Formik<\/strong>\u5728<strong>\u8868\u5355\u9a8c\u8bc1<\/strong>\u3001<strong>\u8868\u5355\u63d0\u4ea4<\/strong>\u64cd\u4f5c\u548c<strong>formik\u72b6\u6001\u7ba1\u7406<\/strong>\u7b49\u65b9\u9762\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u4fbf\u5229\u3002\u5b83\u7b80\u5316\u4e86\u9519\u8bef\u7ba1\u7406\u548c<strong>\u9a8c\u8bc1\u8fc7\u7a0b<\/strong>\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u5927\u578b\u4e14\u590d\u6742\u7684\u8868\u5355\u65f6\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm i formik<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u6210\u578b<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 3. TanStack\u67e5\u8be2 <\/h2>\n<p>\u5b83\u81ea\u52a8\u7ba1\u7406\u548c\u66f4\u65b0\u6570\u636e\u66f4\u6539\u3002\u5b83\u7f13\u5b58\u6570\u636e\u5e76\u4f7f\u5176\u53ef\u91cd\u7528\u3002\u5b83\u901a\u8fc7<strong>\u7f13\u5b58\u63d0\u9ad8\u6027\u80fd\u5e76\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u7f51\u7edc\u8bf7\u6c42<\/strong>\u3002\u8be5\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5<strong>\u5728\u540e\u53f0\u81ea\u52a8\u66f4\u65b0\u6570\u636e<\/strong>\u3002\u5b83\u5728\u7528\u6237\u754c\u9762\u4e2d\u63d0\u4f9b\u6700\u65b0\u6570\u636e\u3002\u5b83<strong>\u63d0\u4f9b\u52a8\u6001\u548c\u6700\u65b0\u7684<\/strong>\u6570\u636e\u6765\u589e\u5f3a\u7528\u6237\u4f53\u9a8c\u3002\u901a\u8fc7\u52a8\u6001 URL \u6216\u53c2\u6570\u68c0\u7d22\u6570\u636e\u3002\u901a\u8fc7\u6709\u9488\u5bf9\u6027\u7684\u6570\u636e\u68c0\u7d22\uff0c\u53ef\u4ee5\u786e\u4fdd\u53ea\u6355\u83b7\u5fc5\u8981\u7684\u6570\u636e\u3002\u8fd9\u4f7f\u5f97\u521b\u5efa\u6d4b\u8bd5\u573a\u666f\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u5b83\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u529f\u80fd\u6765\u68c0\u67e5\u548c\u6a21\u62df\u6570\u636e\u72b6\u6001\u3002\u5b83\u63d0\u4f9b\u4e86\u6709\u7528\u7684\u673a\u5236\u6765<strong>\u7ba1\u7406\u9519\u8bef\u5e76\u5411\u7528\u6237\u663e\u793a\u6709\u610f\u4e49\u7684\u9519\u8bef\u6d88\u606f<\/strong>\u3002\u5b83\u5728\u9519\u8bef\u60c5\u51b5\u4e0b\u63d0\u4f9b\u91cd\u8bd5\u9009\u9879\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211@tanstack\/react-query<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0@tanstack\/react-query <\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 4. \u6c89\u6d78 <\/h2>\n<p><strong>\u4e0d\u53ef\u53d8<\/strong>\u662f\u4e00\u4e2a\u4fc3\u8fdb<strong>\u72b6\u6001\u66f4\u65b0<\/strong>\u7684\u5e93\u3002\u5b83\u5141\u8bb8\u60a8\u5728\u529f\u80fd\u4e0a\u8f7b\u677e\u5730\u66f4\u6539\u72b6\u6001\u66f4\u65b0\uff0c\u800c\u65e0\u9700\u8fdb\u884c\u7a81\u53d8\u3002\u5f53\u4e0e<strong>\u72b6\u6001\u7ba1\u7406\u5de5\u5177\uff08\u4f8b\u5982 Redux<\/strong>\uff09\u4e00\u8d77\u4f7f\u7528\u65f6\uff0c\u5b83\u5141\u8bb8<strong>\u60a8\u5bf9\u4e0d\u53ef\u53d8\u7684\u72b6\u6001\u7ed3\u6784\u8fdb\u884c\u66f4\u6e05\u6670\u3001\u66f4\u6613\u4e8e\u7406\u89e3\u7684\u66f4\u65b0<\/strong>\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u6c89\u6d78<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u6d78\u5165\u5668<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 5. \u53cd\u5e94\u5f39\u7c27 <\/h2>\n<p>\u5b83\u662f\u4e00\u4e2a\u7528\u4e8e\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d<strong>\u521b\u5efa\u52a8\u753b\u548c\u8fc7\u6e21<\/strong>\u7684\u5e93\u3002\u5b83\u7279\u522b\u5e7f\u6cdb\u5730\u7528\u4e8e\u60f3\u8981<strong>\u6dfb\u52a0\u52a8\u753b\u548c\u52a8\u6001\u4ea4\u4e92<\/strong>\u3002<\/p>\n<p>\u7684\u9879\u76ee <\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u7684\u53cd\u5e94\u6625\u5929<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0@react-spring\/web<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 6.React\u865a\u62df\u5316 <\/h2>\n<p>\u5b83\u5141\u8bb8\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u800c\u4e0d\u4f1a\u9047\u5230\u6027\u80fd\u95ee\u9898\u3002\u5b83\u901a\u8fc7<strong>\u4ec5\u6e32\u67d3<\/strong>\u53ef\u89c1\u5143\u7d20\u6765\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u6e32\u67d3\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u53cd\u5e94\u865a\u62df\u5316<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u53cd\u5e94\u865a\u62df\u5316<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 7. \u53cd\u5e94DnD <\/h2>\n<p>\u5b83\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5e93\uff0c\u7528\u4e8e\u5411\u7528\u6237\u754c\u9762\u6dfb\u52a0\u52a8\u6001\u4ea4\u4e92\uff0c\u4f8b\u5982<strong>\u62d6\u653e<\/strong>\u3002\u5373\u4f7f\u662f\u590d\u6742\u7684\u62d6\u653e\u64cd\u4f5c\u4e5f\u80fd\u8f7b\u677e\u5b9e\u73b0\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u53cd\u5e94-dnd<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u53cd\u5e94\u62d6\u653e<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 8.\u6210\u5e27\u5668\u8fd0\u52a8 <\/h2>\n<p><strong>Framer Motion<\/strong> \u662f\u4e00\u4e2a\u73b0\u4ee3\u5e93\uff0c\u53ef\u7528\u4e8e\u521b\u5efa\u52a8\u753b\u3002\u60a8\u53ef\u4ee5\u8f7b\u677e\u6dfb\u52a0\u548c\u7ba1\u7406\u4e0e React \u517c\u5bb9\u7684<strong>\u52a8\u753b<\/strong>\u3002\u60a8\u53ef\u4ee5\u8f7b\u677e\u5e94\u7528\u4ece\u7b80\u5355\u7684\u8fd0\u52a8\u6548\u679c\u5230\u590d\u6742\u7684\u52a8\u753b\u7684\u6240\u6709\u5185\u5bb9\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm i \u5e27\u8fd0\u52a8<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0\u6846\u67b6\u8fd0\u52a8<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 9. \u5f00\u73a9\u7b11 <\/h2>\n<p>Jest \u4e3a JavaScript \u548c React \u9879\u76ee\u63d0\u4f9b\u6d4b\u8bd5\u5de5\u5177\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm install&#8211;save-dev react-test-renderer<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0&#8211;dev react-test-renderer<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 10. \u6545\u4e8b\u4e66 <\/h2>\n<p>\u5b83\u662f\u4e00\u4e2a\u5728\u9694\u79bb\u73af\u5883\u4e2d\u6d4b\u8bd5 React \u7ec4\u4ef6\u7684\u5de5\u5177\u3002\u5b83\u4f7f\u7ec4\u4ef6\u5f00\u53d1\u548c\u6d4b\u8bd5\u8fc7\u7a0b\u66f4\u52a0\u9ad8\u6548\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u6d4b\u8bd5\u4e0d\u540c\u7684\u7528\u6237\u754c\u9762\u72b6\u6001\u5e76\u53ef\u89c6\u5316\u7ec4\u4ef6\u7684\u529f\u80fd\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211@storybook\/react<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0@storybook\/react<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 11. \u53cd\u5e94 i18next <\/h2>\n<p>\u5b83\u7528\u4e8e\u5728React\u9879\u76ee\u4e2d\u5f00\u53d1<strong>\u591a\u8bed\u8a00<\/strong>\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u4e0e i18next \u96c6\u6210\uff0c\u5e76\u4fc3\u8fdb<strong>\u8bed\u8a00\u66f4\u6539\u64cd\u4f5c<\/strong>\u3002 <strong>\u52a8\u6001\u8bed\u8a00\u5207\u6362<\/strong>\u64cd\u4f5c\u8f7b\u677e\u5b8c\u6210\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm \u6211\u7684\u53cd\u5e94-i18next<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0 i18next-react<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 12.Redux\u5de5\u5177\u5305 <\/h2>\n<p><strong>Redux Toolkit<\/strong> \u662f\u4e00\u4e2a\u4f7f React<strong> \u9879\u76ee\u4e2d\u7684 <\/strong> \u5168\u5c40\u72b6\u6001\u7ba1\u7406\u53d8\u5f97\u66f4\u5bb9\u6613\u3001\u66f4\u9ad8\u6548\u7684\u5de5\u5177\u3002\u5b83\u901a\u8fc7\u7b80\u5316 <strong>Redux<\/strong> \u7684\u590d\u6742\u7ed3\u6784\u6765\u5e2e\u52a9\u60a8\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u5185\u7684\u6570\u636e\u6d41\u3002\u5373\u4f7f\u5728\u5927\u578b\u590d\u6742\u9879\u76ee\u4e2d\uff0c\u5b83\u4e5f\u4e3a\u6570\u636e\u7ba1\u7406\u548c\u6570\u636e\u66f4\u65b0\u63d0\u4f9b\u4e86\u6e05\u6670\u7684\u7ed3\u6784\u3002\u5b83\u8fd8\u4e0e <strong>Redux DevTools<\/strong> \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u63d0\u4f9b\u9ad8\u7ea7\u8c03\u8bd5\u548c\u65f6\u95f4\u65c5\u884c\u8c03\u8bd5\u529f\u80fd\u3002<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<ul>\n<li>\n<p>npm install @reduxjs\/toolkit<\/p>\n<\/li>\n<li>\n<p>\u7eb1\u7ebf\u6dfb\u52a0@reduxjs\/toolkit<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2> 13. \u8f74 <\/h2>\n<p>\u5b83\u7ba1\u7406React\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5411\u5916\u90e8\u8d44\u6e90\uff08API\u3001\u540e\u7aef\u7b49\uff09\u53d1\u9001\u548c\u63a5\u6536\u6570\u636e\u7684\u8fc7\u7a0b\u3002\u5b83\u7684\u57fa\u4e8e Promise \u7684 **\u7ed3\u6784\u53ef\u4ee5\u8f7b\u677e\u5730\u4e0e **async\/await<strong> \u548c then\/catch \u7ed3\u6784\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u8fd8\u63d0\u4f9b\u8bf7\u6c42\u8d85\u65f6\u3001\u81ea\u52a8\u8f6c\u6362\u3001\u5168\u5c40\u914d\u7f6e\u7b49\u529f\u80fd\u3002<\/strong> <\/p>\n<p>\u5b89\u88c5<strong><\/strong> <\/p>\n<ul>\n<li>npm \u6211 axios\n<\/p>\n<\/li>\n<li>\u7eb1\u7ebf\u6dfb\u52a0 axios\n<\/p>\n<\/li>\n<\/ul>\n<hr>\n<p> \u7ed3\u8bba <\/p>\n<h2> <\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u7814\u7a76\u4e86\u91cd\u8981\u7684 React \u5e93\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5c06\u5e93\u5305\u542b\u5728 React \u9879\u76ee\u4e2d\u6765\u589e\u52a0\u5e94\u7528\u7a0b\u5e8f\u7684\u529f\u80fd\u3002 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u672c\u5730\u8c03\u8bd5\u8fdc\u7a0b\u957f\u8fde\u63a5\uff1a\u6709\u54ea\u4e9b\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6cd5\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93 \u6536\u85cf \u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0\u300a\u7528\u4e8e\u73b0\u4ee3 Web \u5f00\u53d1\u7684\u5b9e\u7528 React \u5e93\u300b\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01 \u5728\u672c\u6587\u4e2d\uff0c\u6211\u5c06\u8ba8\u8bba\u60a8\u53ef\u4ee5\u5728 React \u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u5e93\u3002 \u5982\u679c\u4f60\u559c\u6b22\u6211\u7684\u6587\u7ae0\uff0c\u53ef\u4ee5\u8bf7\u6211\u4e00\u676f\u5496\u5561:) \u7ed9\u6211\u4e70\u5496\u5561 1. \u6837\u5f0f\u7ec4\u4ef6 \u5b83\u662f\u4e00\u4e2a\u4f7f CSS \u5728 React \u5e94\u7528\u7a0b\u5e8f\u4e2d\u57fa\u4e8e\u7ec4\u4ef6\u7f16\u5199\u7684\u5e93\u3002\u7531\u4e8e\u5b83\u5177\u6709\u57fa\u4e8e\u7ec4\u4ef6\u7684\u7ed3\u6784\uff0c\u56e0\u6b64\u5b83\u5141\u8bb8\u60a8\u4ee5\u6a21\u5757\u5316\u65b9\u5f0f\u5355\u72ec\u8bbe\u7f6e\u6bcf\u4e2a\u7ec4\u4ef6\u7684\u6837\u5f0f\u3002\u5b83\u8fd8\u63d0\u4f9b\u52a8\u6001\u6837\u5f0f\u548c\u4e3b\u9898\u4e4b\u95f4\u7684\u5207\u6362\u7b49\u529f\u80fd\u3002 \u5b89\u88c5 npm \u6211\u7684\u6837\u5f0f\u7ec4\u4ef6 \u7eb1\u7ebf\u6dfb\u52a0\u6837\u5f0f\u7ec4\u4ef6 2.\u798f\u7c73\u514b\u2014\u2014\u662f\u7684 Formik\u5728\u8868\u5355\u9a8c\u8bc1\u3001\u8868\u5355\u63d0\u4ea4\u64cd\u4f5c\u548cformik\u72b6\u6001\u7ba1\u7406\u7b49\u65b9\u9762\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u4fbf\u5229\u3002\u5b83\u7b80\u5316\u4e86\u9519\u8bef\u7ba1\u7406\u548c\u9a8c\u8bc1\u8fc7\u7a0b\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u5927\u578b\u4e14\u590d\u6742\u7684\u8868\u5355\u65f6\u3002 \u5b89\u88c5 npm i formik \u7eb1\u7ebf\u6dfb\u52a0\u6210\u578b 3. TanStack\u67e5\u8be2 \u5b83\u81ea\u52a8\u7ba1\u7406\u548c\u66f4\u65b0\u6570\u636e\u66f4\u6539\u3002\u5b83\u7f13\u5b58\u6570\u636e\u5e76\u4f7f\u5176\u53ef\u91cd\u7528\u3002\u5b83\u901a\u8fc7\u7f13\u5b58\u63d0\u9ad8\u6027\u80fd\u5e76\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u7f51\u7edc\u8bf7\u6c42\u3002\u8be5\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u5728\u540e\u53f0\u81ea\u52a8\u66f4\u65b0\u6570\u636e\u3002\u5b83\u5728\u7528\u6237\u754c\u9762\u4e2d\u63d0\u4f9b\u6700\u65b0\u6570\u636e\u3002\u5b83\u63d0\u4f9b\u52a8\u6001\u548c\u6700\u65b0\u7684\u6570\u636e\u6765\u589e\u5f3a\u7528\u6237\u4f53\u9a8c\u3002\u901a\u8fc7\u52a8\u6001 URL \u6216\u53c2\u6570\u68c0\u7d22\u6570\u636e\u3002\u901a\u8fc7\u6709\u9488\u5bf9\u6027\u7684\u6570\u636e\u68c0\u7d22\uff0c\u53ef\u4ee5\u786e\u4fdd\u53ea\u6355\u83b7\u5fc5\u8981\u7684\u6570\u636e\u3002\u8fd9\u4f7f\u5f97\u521b\u5efa\u6d4b\u8bd5\u573a\u666f\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u5b83\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u529f\u80fd\u6765\u68c0\u67e5\u548c\u6a21\u62df\u6570\u636e\u72b6\u6001\u3002\u5b83\u63d0\u4f9b\u4e86\u6709\u7528\u7684\u673a\u5236\u6765\u7ba1\u7406\u9519\u8bef\u5e76\u5411\u7528\u6237\u663e\u793a\u6709\u610f\u4e49\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u5728\u9519\u8bef\u60c5\u51b5\u4e0b\u63d0\u4f9b\u91cd\u8bd5\u9009\u9879\u3002 \u5b89\u88c5 npm \u6211@tanstack\/react-query \u7eb1\u7ebf\u6dfb\u52a0@tanstack\/react-query 4. \u6c89\u6d78 \u4e0d\u53ef\u53d8\u662f\u4e00\u4e2a\u4fc3\u8fdb\u72b6\u6001\u66f4\u65b0\u7684\u5e93\u3002\u5b83\u5141\u8bb8\u60a8\u5728\u529f\u80fd\u4e0a\u8f7b\u677e\u5730\u66f4\u6539\u72b6\u6001\u66f4\u65b0\uff0c\u800c\u65e0\u9700\u8fdb\u884c\u7a81\u53d8\u3002\u5f53\u4e0e\u72b6\u6001\u7ba1\u7406\u5de5\u5177\uff08\u4f8b\u5982 Redux\uff09\u4e00\u8d77\u4f7f\u7528\u65f6\uff0c\u5b83\u5141\u8bb8\u60a8\u5bf9\u4e0d\u53ef\u53d8\u7684\u72b6\u6001\u7ed3\u6784\u8fdb\u884c\u66f4\u6e05\u6670\u3001\u66f4\u6613\u4e8e\u7406\u89e3\u7684\u66f4\u65b0\u3002 \u5b89\u88c5 npm \u6211\u6c89\u6d78 \u7eb1\u7ebf\u6dfb\u52a0\u6d78\u5165\u5668 5. \u53cd\u5e94\u5f39\u7c27 \u5b83\u662f\u4e00\u4e2a\u7528\u4e8e\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u521b\u5efa\u52a8\u753b\u548c\u8fc7\u6e21\u7684\u5e93\u3002\u5b83\u7279\u522b\u5e7f\u6cdb\u5730\u7528\u4e8e\u60f3\u8981\u6dfb\u52a0\u52a8\u753b\u548c\u52a8\u6001\u4ea4\u4e92\u3002 \u7684\u9879\u76ee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53685","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53685"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53685\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}