Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode auto imports for React Native with JavaScript

I know VSCode supports auto import for JavaScript.

For some reason, it does not work with React Native. There is even a dedicated section on the VSCode website for this. But it only answers how to fix this problem for Typescript (using allowSyntheticDefaultImports). I want it for JavaScript (ES6).

I tried explicitly setting "javascript.suggest.autoImports": true, in my settings.json but that wouldn't change anything, since true is the default anyways.

How to get auto imports for React Native with JavaScript in VSCode?

PS: This plugin (suggested in this similar question) is also only for TypeScript. Besides that, since VSCode includes auto import out of the box there should be a solution without an extension for RN and JS.

like image 479
J. Hesters Avatar asked Sep 12 '25 11:09

J. Hesters


1 Answers

You might have the 'Auto Imports' option disabled.
In VSCode go to Settings and search for 'Auto Imports' option, it should be something like this:

enter image description here

Just activate it if it's disabled and you'll be fine.

like image 95
Mohamed Abkal Avatar answered Sep 14 '25 02:09

Mohamed Abkal