What is the point of importing React and then importing the Component as well if you can simply access the Component directly from React anyway?
This is what I mean.
You can do:
import React, {Component} from 'react'
and then write
class SomeComponent extends Component
but you can also do:
import React from 'react'
and then write
class SomeComponent extends React.Component
What is the difference here? What pain does the first approach really relieves? It seems to me that the second option is much more concise and that the first option is pretty redundant because you have access to Component
whether or not you import it explicitly.
A much clear analogy would be:
import Animals from 'the-world';
This would get all animals in the world. Now why would one want to write:
import Animals, { Goat } from 'the-world';
If Animals
get all animals in the world, then why import Goat
separately. I mean it exists already in the Animals
object.