question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docs: named imports

See original GitHub issue

Description In the docs, the import of the module in the same namespace has been done using multiple import statements.

Current behaviour

import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';

Proposed Behaviour

import {AppBar, Toolbar, Typography, Button} from '@material-ui/core';

Why so Named imports help to keep track of imports from a specific package, as well as makes code a bit cleaner.

Let’s discuss: loudspeaker:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

5reactions
mbrookescommented, Jul 31, 2019

I was on the fence here. I like the idea of demonstrating simplified imports for core, but I can understand the concern about “it depends” in general for icons.

On reflection, my gut feeling is that if the demos use differing approaches for core and icons, less experienced developers will follow the pattern shown, while more experienced developers will understand the difference.

4reactions
eps1loncommented, Aug 1, 2019

People copy & paste the demos.

Some actually write code themselves and don’t just copy&paste their apps.

We could document the best tradeoff in the demos and add a FAQ section about the difference?

Yeah like that worked in the past. It didn’t even work for this issue that got opened without any mention of the documented trade-offs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

import - JavaScript - MDN Web Docs - Mozilla
Name of the exports to be imported. The name can be either an identifier or a string literal, depending on what module-name declares...
Read more >
eslint-plugin-import/named.md at main - GitHub
Verifies that all named imports are part of the set of named exports in the referenced module. For export , verifies that all...
Read more >
IMPORTHTML - Google Docs Editors Help
IMPORTXML : Imports data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds. IMPORTRANGE...
Read more >
5. The import system — Python 3.11.1 documentation
The import statement combines two operations; it searches for the named module, then it binds the results of that search to a name...
Read more >
What should you choose: named imports or default imports?
First, default imports are nameless. Or rather : it looses its name during exportation. Be it variables, constants, objects, classes, etc : they ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found