epicweb-dev / react-hooks

Learn React Hooks! 🎣 ⚛

Home Page:https://hooks.epicreact.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React imports could be shorten

LingVuDev opened this issue · comments

This is just a suggestion in almost any exercise file. Instead of write the import like this:

import * as React from 'react';

it could be done like this, without the *:

import React from 'react';

or even import hooks separately, like:

import { useState, useEffect } from 'react';

I don't know if this feedback is helpful or not. I mean it is just a subtle difference (and maybe just personal preference as well) I just find it more common in other React projects like this.

Hope this was helpful. :)

Hi @LingVuDev! I've actually got an article about this: https://epicreact.dev/importing-react-through-the-ages

The import * as React from 'react' is quite intentional :)