What is the right way to import React import React from 'react' or import react from 'react' as VSCode is giving the second one as Auto-suggestion .
What is the right way to import React import React from 'react' or import react from 'react' as VSCode is giving the second one as Auto-suggestion .
There's no difference between the two examples you shared other than what you named the default export when you imported it. Either will work and are syntactically correct.
The standard convention is to Titlecase React when importing though:
import React from 'react';
Because of separate jsx-runtime (https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) it it is not necessary to explicitly import React.
Just use named imports:
import type { FunctionalComponent } from 'react';
import { useState, useEffect } from 'react';