On pressing CTRL + S , prettier removes React import from tsx files, assuming its not used in the file.
How to fix this ?
On pressing CTRL + S , prettier removes React import from tsx files, assuming its not used in the file.
How to fix this ?
My tsconfig.json had the following settings:
{
"compilerOptions": {
"jsx": "preserve"
}
}
Changing jsx value from preserve to react solved the issue.
{
"compilerOptions": {
"jsx": "react"
}
}
Reference : https://github.com/microsoft/vscode/issues/152150#issuecomment-1156717872