When using hooks for state, effect, context, etc, I do this:
import React, { useState, useEffect, useContext } from 'react';
However, I noticed that the following works just fine:
import React from 'react';
const App = () => {
const [counter, setCounter] = React.useState();
React.useEffect(() => console.log('hello!'), []);
}
My question is, is there any difference between those two? Maybe when it comes to bundle size, or is Webpack smart enough to handle that?
Otherwise, is that bad practice? Which approach do you use, and why?