问题
Already tried https://github.com/necolas/react-native-web/issues/832
Got:
for:
I thought the issue might be the linter error I was getting b/c of the react-native
aliasing of react-native-web
(which for some reason, TypeScript can't figure out...). Was able to resolve that via npm i -D react-native @types/react-native
.
However, still got the same error.
Next, I tried converting my SFC (stateless functional component) to a class component. Still got:
So I'm wondering why I'm getting this error message even though I've configured TypeScript.
回答1:
This was my issue: In my tsconfig.json
, I had "jsx": "preserve"
. Switching to "jsx": "react"
fixed it!
来源:https://stackoverflow.com/questions/55231350/why-is-typescript-not-parsing-my-react-native-web-code-not-using-create-rea