Reputation: 1
When I am importing a module in reactjs by typing import React, from
'react';` in from it is showing me error and the code won't work but if I copy paste it the code works perfectly...
What might be the reason ?
Upvotes: 0
Views: 67
Reputation: 81
If you just want import react, use this:
import React from "react";
no need coma
Upvotes: 0
Reputation: 260
It is enough to write like this:
import React from 'react';
and if you want to import more modules, you can do like this example:
import React, { useState, useEffect } from 'react';
Upvotes: 2