当使用实验版的react-dom、react-relay和react时,我得到了如下错误信息
react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.createRoo
TypeError: useTransition is not a function or its return value is not iterable
它可以通过使用
unstable_createRoot和unstable_useTransition。
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import * as serviceWorker from './serviceWorker'
const rootEl = document.getElementById('root')
// @ts-ignore
ReactDOM.unstable_createRoot(rootEl).render(<App />)
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
serviceWorker.unregister()