{"id":1155,"date":"2022-06-04T22:59:02","date_gmt":"2022-06-04T14:59:02","guid":{"rendered":"https:\/\/sora.sound.moe\/?p=1155"},"modified":"2022-06-04T22:59:02","modified_gmt":"2022-06-04T14:59:02","slug":"react-18-usesyncexternalstore","status":"publish","type":"post","link":"https:\/\/sora.sound.moe\/?p=1155","title":{"rendered":"React 18: useSyncExternalStore"},"content":{"rendered":"\n<p>React \u771f\u662f\u8d8a\u6765\u8d8a\u590d\u6742\u4e86\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u4f17\u6240\u5468\u77e5\uff0cReact 18 \u5f15\u5165\u4e86\u6240\u8c13 Concurrent Rendering\uff0c\u7b80\u5355\u6765\u8bb2\uff0c\u7ec4\u4ef6\u7684\u6e32\u67d3\u5c06\u4e0d\u518d\u662f\u4e00\u4e2a\u540c\u6b65\u8fc7\u7a0b\uff0c\u800c\u662f\u88ab\u5206\u7247\uff0c\u53ef\u80fd\u5206\u4e3a\u591a\u6b21\u8fdb\u884c\u3002\u6ce8\u610f\uff0c\u662f\u4e00\u6b21\u6e32\u67d3\u88ab\u5206\u4e3a\u591a\u4e2a\u65f6\u95f4\u5206\u7247\u6267\u884c\uff0c\u5373\u5728\u6e32\u67d3\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u7a7f\u63d2\u5176\u4ed6\u4efb\u52a1\u6267\u884c\u3002<\/p>\n\n\n\n<p>\u8fd9\u5c31\u5f15\u5165\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u5047\u5982\u5728\u4e00\u6b21\u6e32\u67d3\u8fc7\u7a0b\u4e2d\uff0c\u7ec4\u4ef6\u4f9d\u8d56\u7684\u5916\u90e8\u6570\u636e\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u4f1a\u5bfc\u81f4\u4ec0\u4e48\u7ed3\u679c\uff1f<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>React \u7ec4\u4ef6\u7684\u5185\u90e8\u6570\u636e\uff0c\u4f8b\u5982 useState \u7b49\u4e0d\u4f1a\u6709\u95ee\u9898\uff0c\u56e0\u4e3a React \u5185\u90e8\u5bf9\u8fd9\u79cd\u60c5\u51b5\u8fdb\u884c\u4e86\u5904\u7406\uff0c\u4fdd\u8bc1\u4e86\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002<\/p><\/blockquote>\n\n\n\n<p>\u8fd9\u79cd\u60c5\u51b5\u88ab React WG \u79f0\u4e3a\u6495\u88c2\uff08Tearing\uff09\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4 UI \u4e0a\u51fa\u73b0\u4e86\u4e0d\u540c\u90e8\u5206\u5448\u73b0\u7684\u662f\u4e0d\u540c\u6570\u636e\u7684\u6e32\u67d3\u6548\u679c\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>Tearing refers to visual inconsistency. It means that a UI shows multiple values for the same state[1].<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/3df29b67e19ed60ad572e16fa7e5e5cfed757a93\/6140a\/images\/use_sync_external_store\/concurrent_rendering_react_18.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u79cd\u95ee\u9898\uff0cReact \u5f15\u5165\u4e86\u4e00\u4e2a\u65b0\u7684 Hooks\uff1auseSyncExternalStore\uff08\u524d\u8eab\u4e3auseMutableSource\uff09\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a Hooks \u7684\u51fd\u6570\u7b7e\u540d\u662f\u8fd9\u6837\u7684<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const state = useSyncExternalStore(subscribe, getSnapshot&#91;, getServerSnapshot]);<\/code><\/pre>\n\n\n\n<p>\u4e00\u4e2a\u5178\u578b\u7528\u6cd5\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import { useSyncExternalStore } from 'react';\n\nconst useSelectorByUseSyncExternalStore = (store, selector) =&gt; {\n    return useSyncExternalStore(\n        store.subscribe,\n        useCallback(() =&gt; selector(store.getState()), &#91;store, selector])\n    );\n}<\/code><\/pre>\n\n\n\n<p>\u5176\u4e2d <code>subscribe<\/code> \u662f external store \u4e0a\u9700\u8981\u5b9e\u73b0\u7684\u4e00\u4e2a\u65b9\u6cd5\uff0c\u7528\u4e8e\u6ce8\u518c\u56de\u8c03\u51fd\u6570\uff0c\u5f53 state \u53d1\u751f\u53d8\u5316\u65f6\u901a\u77e5 React\u3002\u800c <code>getSnapshot<\/code> \u662f\u4e00\u4e2a\u7528\u4e8e\u83b7\u53d6 external store \u4e0a\u6700\u65b0 state \u7684\u65b9\u6cd5\uff0c\u5982\u53ea\u9009\u53d6 state \u4e2d\u4e00\u90e8\u5206\uff0c\u4e5f\u662f\u5728\u8fd9\u4e00\u65b9\u6cd5\u4e2d\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>React \u5bf9\u4e8e\u8fd9\u79cd Tearing \u7684\u60c5\u51b5\u7684\u5904\u7406\u65b9\u6cd5\u662f\uff0c<strong>\u4e2d\u65ad<\/strong>\u5f53\u524d\u6b63\u5728\u8fdb\u884c\u7684 Concurrent Render\uff0c\u91cd\u65b0\u8fdb\u884c\u4e00\u6b21 Sync Render\u3002<\/p>\n\n\n\n<p>React \u5982\u4f55\u77e5\u9053\u53d1\u751f\u4e86 external store \u6570\u636e\u53d8\u5316\u5462\uff1f\u901a\u8fc7\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ol><li>\u5f53 <code>subscribe<\/code> \u7684\u56de\u8c03\u51fd\u6570\u88ab\u8c03\u7528\u65f6\uff0c\u8bf4\u660e\u6570\u636e\u53d1\u751f\u53d8\u5316\u4e86\uff0c\u6b64\u65f6 React \u624b\u52a8\u89e6\u53d1 Sync Render<\/li><li>\u5728 reconcile \u548c commit \u9636\u6bb5\u8fdb\u884c\u4e24\u6b21\u4e00\u81f4\u6027\u68c0\u67e5\uff0c\u4f7f\u7528 <code>getSnapshot<\/code> \u65b9\u6cd5\u83b7\u5f97\u6700\u65b0 state \u4e0e\u4e4b\u524d\u7f13\u5b58\u7684 state \u8fdb\u884c\u6bd4\u5bf9\uff08\u9ed8\u8ba4\u4f7f\u7528 <code>Object.is<\/code>\uff09\uff0c\u5982\u4e0d\u4e00\u81f4\uff0c\u91cd\u65b0\u8fdb\u884c\u4e00\u6b21 Sync Render.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-uagb-inline-notice uagb-inline_notice__outer-wrap uagb-inline_notice__align-left uagb-block-9ed6a16b\"><h4 class=\"uagb-notice-title\">\u6ce8\u610f<\/h4><div class=\"uagb-notice-text\"><p>\u7531\u4e8e\u4f7f\u7528 <code>Object.is<\/code> \u8fdb\u884c\u6bd4\u8f83\uff0c\u6240\u4ee5 <code>getSnapshot<\/code> \u65b9\u6cd5\u8fd4\u56de\u7684\u5e94\u8be5\u662f\u4e00\u4e2a\u7a33\u5b9a\u7684\u5f15\u7528\uff0c\u5e76\u5728 state \u53d8\u5316\u540e\u53d8\u5316\u3002\u4e5f\u5c31\u8bf4\uff0c\u5927\u6982\u7387\u8981\u641e\u4e00\u5957 immutable \u7684\u3002<\/p><\/div><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5982\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\uff0c\u5c31\u7b97 external store \u6ca1\u6709\u5b9e\u73b0 <code>subscribe<\/code> \u529f\u80fd\uff0c\u53ea\u8981\u6709\u80fd\u591f\u83b7\u5f97\u6700\u65b0 state \u7684\u65b9\u6cd5\uff0c\u5c31\u80fd\u4f7f\u7528\u8fd9\u4e2a Hooks \u907f\u514d\u8fd9\u4e2a\u60c5\u51b5\u4e0b\u7684 Tearing\u3002<\/p>\n\n\n\n<p>\u5728\u8fd9\u6837\u7684\u673a\u5236\u4e2d\uff0c\u6700\u5dee\u60c5\u51b5\u7684\u5f00\u9500\u662f\u591a\u8fdb\u884c\u4e00\u6b21 Sync Render \u548c\u4e24\u6b21\u4e00\u81f4\u6027\u68c0\u67e5\u3002\u4f46\u662f\u7531\u4e8e Render \u8fc7\u7a0b\u4e2d external store \u7684 state \u53d1\u751f\u6539\u53d8\u5e94\u8be5\u662f\u5c0f\u6982\u7387\u4e8b\u4ef6\uff0c\u53ef\u4ee5\u63a5\u53d7\u3002<\/p>\n\n\n\n<p>\u6b64\u5916\uff0c\u4e3a\u4e86\u65b9\u4fbf\u4f7f\u7528\uff0cReact \u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e2a with selector \u7684\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export function useSyncExternalStoreWithSelector&lt;Snapshot, Selection&gt;(\n  subscribe: (() =&gt; void) =&gt; () =&gt; void,\n  getSnapshot: () =&gt; Snapshot,\n  getServerSnapshot: void | null | (() =&gt; Snapshot),\n  selector: (snapshot: Snapshot) =&gt; Selection,\n  isEqual?: (a: Selection, b: Selection) =&gt; boolean,\n): Selection<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u7528\u6765\u81ea\u5b9a\u4e49 selector \u51fd\u6570\uff0c\u4ee5\u53ca\u81ea\u5b9a\u4e49\u6bd4\u8f83\u6570\u636e\u662f\u5426\u4e00\u81f4\u7684\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u5728\u63a8\u51fa <code>useSyncExternalStore<\/code> \u4e4b\u524d\uff0cReact \u7684\u65b9\u6848\u662f\u4e00\u4e2a\u53eb\u505a <code>useMutableSource<\/code> \u7684 Hooks\uff0c\u90a3\u4e48\u4e3a\u4ec0\u4e48\u505a\u8fd9\u4e2a\u53d8\u66f4\u5462\u3002\u8fd9\u5c31\u9700\u8981\u56de\u987e\u4e00\u4e0b\u5386\u53f2\u3002<\/p>\n\n\n\n<p><code>useMutableSource<\/code> \u7684\u51fd\u6570\u7b7e\u540d\u662f\u8fd9\u6837\u7684<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export default function createMutableSource&lt;Source: $NonMaybeType&lt;mixed&gt;&gt;(\n  source: Source,\n  getVersion: MutableSourceGetVersionFn,\n): MutableSource&lt;Source&gt;\n\nexport function useMutableSource&lt;Source, Snapshot&gt;(\n  source: MutableSource&lt;Source&gt;,\n  getSnapshot: MutableSourceGetSnapshotFn&lt;Source, Snapshot&gt;,\n  subscribe: MutableSourceSubscribeFn&lt;Source, Snapshot&gt;,\n): Snapshot<\/code><\/pre>\n\n\n\n<p>\u9996\u5148\uff0c\u9700\u8981\u521b\u5efa\u4e00\u4e2a <code>MutableSource<\/code>\uff0c\u8fd9\u4e2a Source \u5fc5\u987b\u6709\u4e00\u4e2a <code>version<\/code> \u5c5e\u6027\uff0c\u53ea\u8981\u6570\u636e\u53d1\u751f\u53d8\u5316\uff0c<code>version<\/code> \u5c31\u5fc5\u987b\u53d1\u751f\u53d8\u5316\u3002\u800c <code> useMutableSource<\/code> \u7684\u53c2\u6570\u548c <code>useSyncExternalStore<\/code> \u7684\u53c2\u6570\u57fa\u672c\u4e00\u81f4\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u67e5\u770b\u6e90\u7801\u53d1\u73b0\u5176\u6838\u5fc3\u5b9e\u73b0\u5927\u6982\u5982\u4e0b\uff08\u6709\u5220\u51cf\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function useMutableSource&lt;Source, Snapshot&gt;(\n    hook: Hook,\n    source: MutableSource&lt;Source&gt;,\n    getSnapshot: MutableSourceGetSnapshotFn&lt;Source, Snapshot&gt;,\n    subscribe: MutableSourceSubscribeFn&lt;Source, Snapshot&gt;\n): Snapshot {\n    const getVersion = source._getVersion;\n    const version = getVersion(source._source);\n\n    let &#91;snapshot, setSnapshot] = dispatcher.useState(() =&gt;\n        readFromUnsubcribedMutableSource(root, source, getSnapshot)\n    );\n\n    dispatcher.useEffect(() =&gt; {\n        const handleChange = () =&gt; {\n            setSnapshot(latestGetSnapshot(source._source));\n        };\n        const unsubscribe = subscribe(source._source, handleChange);\n        const maybeNewVersion = getVersion(source._source);\n        if (!is(version, maybeNewVersion)) {\n            const maybeNewSnapshot = getSnapshot(source._source);\n            if (!is(snapshot, maybeNewSnapshot)) {\n                setSnapshot(maybeNewSnapshot);\n            }\n        }\n\n        return unsubscribe;\n    }, &#91;source, subscribe]);\n}\n<\/code><\/pre>\n\n\n\n<p>\u4ece\u4e2d\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u5176\u6838\u5fc3\u673a\u5236\u5c31\u662f\u5728\u6570\u636e\u53d1\u751f\u53d8\u5316\u65f6\u901a\u8fc7 <code>setState<\/code> \u540c\u6b65\u5230\u72b6\u6001\u4e0a\u3002\u5176\u4e2d <code>version<\/code> \u8fd9\u4e00\u8bbe\u5b9a\u53ea\u5728\u7ec4\u4ef6\u8bfb\u53d6\u4e86\u5916\u90e8 <code>store<\/code> \u4f46\u8fd8\u6ca1\u6709 <code>subscribe<\/code> \u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u8fd9\u6837\u7684\u8bbe\u8ba1\uff0c\u4e0d\u80fd\u8bf4\u5197\u4f59\uff0c\u81f3\u5c11\u5e94\u8be5\u662f\u6709\u4e9b\u4e0d\u591f\u7d27\u51d1\u5427\uff1f\u800c\u4e14\u8fd8\u9700\u8981\u5148\u8fdb\u884c\u521b\u5efa <code>store<\/code> \u518d\u4f7f\u7528\uff0c\u591a\u5c11\u6709\u70b9\u5570\u55e6\u3002\u76f8\u6bd4\u8f83\u4e4b\u4e0b <code>useSyncExternalStore<\/code> \u5c06\u66f4\u591a\u7684\u5de5\u4f5c\u653e\u5230\u4e86 React \u5185\u90e8\u5b8c\u6210\uff0c\u800c\u4e14\u53bb\u6389\u4e86 <code>version<\/code> \u8fd9\u4e00\u8bbe\u8ba1\uff08\u53ca\u5176\u9690\u542b\u7684\u7ea6\u5b9a\uff09\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\uff0c\u4fc3\u4f7f React \u653e\u5f03\u8fd9\u4e2a\u65b9\u6848\u7684\u539f\u56e0\uff0c\u5e76\u4e0d\u8fd9\u4e48\u7b80\u5355\uff0c\u800c\u662f\u56e0\u4e3a\uff1a<\/p>\n\n\n\n<ol><li><code>getSnapshot<\/code> \u51fd\u6570\u9690\u542b\u4e86 <code>selector<\/code> \u7684\u529f\u80fd\uff0c\u7531\u4e8e <code>getSnapshot<\/code> \u9700\u8981\u7a33\u5b9a\u6307\u5411\uff08\u4e0a\u9762\u6e90\u7801\u7701\u7565\u4e86\u8fd9\u4e00\u90e8\u5206\uff0c\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/github.com\/facebook\/react\/pull\/18000\/files#diff-aeec998530b94be0e2111b96b6b40c165ef6b57c122401e3a3e0dacd0767f9a8R1058\">\u8fd9\u91cc<\/a>\uff09\uff0c\u5bfc\u81f4 <code>selector<\/code> \u4e5f\u9700\u8981\u7528 <code>useCallback<\/code> \u7b49\u65b9\u6cd5\u4f7f\u5176\u6307\u5411\u7a33\u5b9a\uff0c\u5426\u5219\u4f1a\u91cd\u65b0\u521d\u59cb\u5316 Hooks\u3002\u800c\u8ba9\u6240\u6709\u7684 <code>selector<\/code> \u90fd\u7528 <code>useCallback<\/code> \u5305\u4e00\u5c42\u662f\u989d\u5916\u7684\u5fc3\u667a\uff0cRedux \u7b49\u5e93\u90fd\u5e76\u4e0d\u8981\u6c42\u8fd9\u6837\u505a\uff08\u5185\u90e8\u6709\u5bf9\u5e94\u5904\u7406\uff0c\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/github.com\/reactwg\/react-18\/discussions\/84#discussioncomment-1214010\">\u8fd9\u91cc<\/a>\uff09\u3002<\/li><li><code>useMutableSource<\/code> \u5e94\u5bf9 Tearing \u7684\u7b56\u7565\u5e76\u4e0d\u662f Sync Render\uff0c\u800c\u662f\u8bd5\u56fe\u7ee7\u7eed\u8fdb\u884c <code>Concurrent Render<\/code>\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u53ef\u89c1\u7684\u7ec4\u4ef6 fallback\uff0c\u751a\u81f3\u5bfc\u81f4\u65e0\u5173\u7684\u7ec4\u4ef6\u88ab fallback\uff08eg. Router \u4f7f\u7528\u4e86 useMutableSource\uff09\u3002<\/li><\/ol>\n\n\n\n<p>\/\/ TODO\uff1a\u6e90\u7801\u4e2d\u6ca1\u6709\u4f53\u73b0 <code>useMutableSource<\/code> \u4e3a\u4f55\u4f1a\u5bfc\u81f4\u8fd9\u79cd fallback\uff0c\u53ef\u80fd\u9700\u8981\u8bfb\u4e00\u4e0b React \u7684\u6e90\u7801\uff0c\u800c\u6211\u6ca1\u770b\u8fc7\uff0c\u5148\u6478\u4e86\uff08<\/p>\n\n\n\n<p><code>useSyncExternalStoreWithSelector<\/code> \u4e2d\uff0c\u7531\u4e8e\u5c06 <code>getSnapshot<\/code> \u548c <code>selector<\/code> \u5206\u4e3a\u4e24\u4e2a\u53c2\u6570\uff0c\u56e0\u6b64\u53ef\u4ee5\u5728\u5185\u90e8\u5bf9  <code>selector<\/code> \u505a memorize\uff0c\u7c7b\u4f3c\u4e8e Redux \u7684 selector\uff0c\u4f46\u5b9e\u73b0<a href=\"https:\/\/github.com\/facebook\/react\/blob\/main\/packages\/use-sync-external-store\/src\/useSyncExternalStoreWithSelector.js\">\u4e0d\u592a\u4e00\u6837<\/a>\u3002<\/p>\n\n\n\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5c31\u5148\u5230\u8fd9\u4e86\uff0c\u5e0c\u671b\u80fd\u8282\u7701\u4e00\u4e9b\u4f60\u7684\u65f6\u95f4\uff0c\u4e0b\u671f\u4f30\u8ba1\u4f1a\u5199\u4e00\u7bc7\u5173\u4e8e Suspense \u7684\u3002<\/p>\n\n\n\n<p>React \u5f15\u5165\u4e86 Concurrent \u6a21\u5f0f\u4e4b\u540e\uff0c\u5bf9\u4e8e\u5e93\u4f5c\u8005\u6765\u8bf4\uff0c\u9700\u8981\u989d\u5916\u8003\u8651\u8bb8\u591a\u60c5\u51b5\uff0c\u6709\u65f6\u5019\u4e00\u4e9b\u8fb9\u8fb9\u89d2\u89d2\u5f88\u5bb9\u6613\u51fa\u6bdb\u75c5\u3002\u5bf9\u4e8e\u4e00\u822c\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u4e5f\u8bb8\u6709\u65f6\u5019\u78b0\u5230\u7684\u5947\u602a\u7684 bug \u5c31\u662f\u56e0\u4e3a\u5728 Concurrent \u6a21\u5f0f\u4e2d\u7684\u4e00\u4e9b\u672a\u5904\u7406\u60c5\u51b5\uff0c\u4e3a\u6b64\uff0c\u8fd8\u662f\u505a\u4e00\u4e9b\u4e86\u89e3\u5427\u3002<\/p>\n\n\n\n<p>React \u771f\u662f\u8d8a\u6765\u8d8a\u590d\u6742\u4e86\uff08again<\/p>\n\n\n\n<h2>\u53c2\u8003<\/h2>\n\n\n\n<ol><li><a href=\"https:\/\/blog.saeloun.com\/2021\/12\/30\/react-18-usesyncexternalstore-api\">https:\/\/blog.saeloun.com\/2021\/12\/30\/react-18-usesyncexternalstore-api<\/a><\/li><li><a href=\"https:\/\/github.com\/facebook\/react\/pull\/18000\">https:\/\/github.com\/facebook\/react\/pull\/18000<\/a><\/li><\/ol>\n\n\n\n<h3>\u5ef6\u4f38\u9605\u8bfb<\/h3>\n\n\n\n<ol><li><a href=\"https:\/\/reactjs.org\/docs\/hooks-reference.html#usesyncexternalstore\">https:\/\/reactjs.org\/docs\/hooks-reference.html#usesyncexternalstore<\/a> React \u5b98\u65b9\u6587\u6863\u5bf9\u4e8e useSyncExternalStore \u7684\u8bf4\u660e<\/li><li><a href=\"https:\/\/juejin.cn\/post\/7090063329913208868\">https:\/\/juejin.cn\/post\/7090063329913208868<\/a> \u4e00\u7bc7\u5199\u5f97\u5f88\u597d\u7684\u8bf4\u660e\u6587\u7ae0<\/li><li><a href=\"https:\/\/github.com\/reactwg\/react-18\/discussions\/86\">https:\/\/github.com\/reactwg\/react-18\/discussions\/86<\/a> useMutableSource -&gt; useSyncExternalStore<\/li><li><a href=\"https:\/\/github.com\/reactjs\/rfcs\/blob\/main\/text\/0147-use-mutable-source.md\">https:\/\/github.com\/reactjs\/rfcs\/blob\/main\/text\/0147-use-mutable-source.md<\/a> useMutableSource RFC<\/li><\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>React \u771f\u662f\u8d8a\u6765\u8d8a\u590d\u6742\u4e86\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"twentyseventeen-featured-image":false,"twentyseventeen-thumbnail-avatar":false},"uagb_author_info":{"display_name":"Sora","author_link":"https:\/\/sora.sound.moe\/?author=1"},"uagb_comment_info":0,"uagb_excerpt":"React \u771f\u662f\u8d8a\u6765\u8d8a\u590d\u6742\u4e86\u3002","_links":{"self":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts\/1155"}],"collection":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1155"}],"version-history":[{"count":0,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts\/1155\/revisions"}],"wp:attachment":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}