Home > Blockchain >  The right way to import React
The right way to import React

Time:05-03

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 .

CodePudding user response:

Both work, it does not matter because you are getting the default export either way.

CodePudding user response:

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';
  • Related