I'm using React 17.0.1
via CRA
.
I have one module that I'm using called 'react-vimjs'
that is causing this error. In node_modules/react-vimjs/src/main.tsx
it uses the spread operator {...props}
somewhere and this throws the error:
TypeError: React.__spread is not a function
However, when I use the spread operator in my OWN files (src/index.tsx)
, it works fine. But when I import that module & use it, it crashes. Why is this being interpreted differently? How do I fix this?
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import Vim, {FileUpload} from 'react-vimjs'
import reportWebVitals from './reportWebVitals';
class VimMarkdown extends React.Component<Props> {
constructor(props: Props){
super(props);
}
render = () => {
const props = {
memPath: './static/vim.js.mem',
}
return(
<div className="vim">
<Vim {...props} ref="vim"></Vim>
</div>
)
}
}
interface Props{}
ReactDOM.render(
<React.StrictMode>
<VimMarkdown/>
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
question from:
https://stackoverflow.com/questions/65912251/spread-operator-not-working-within-imported-modules-works-in-my-own-code-howeve 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…