Skip to content

Instantly share code, notes, and snippets.

@paulvollmer
Last active October 13, 2019 20:16
Show Gist options
  • Save paulvollmer/7547b80abf77430d910a2324e04a16cc to your computer and use it in GitHub Desktop.
Save paulvollmer/7547b80abf77430d910a2324e04a16cc to your computer and use it in GitHub Desktop.
1-current-syntax.md

current import ecmascript syntax for modules

import React from 'react';
import PropTypes from 'prop-types';
import { Add } from '@material-ui/icon';
import { Chip, Divider, Grid, Typography } from '@material-ui/core';
import SelectAttributes from './SelectAttributes';
import Translations from '../../../container/Translations';

below you can see an example of the import groups definition. the syntax is similar to the golang import.

import (
  React            from 'react';
  PropTypes        from 'prop-types';
  import { Add } from '@material-ui/icon';
  import { Chip, Divider, Grid, Typography } from '@material-ui/core';
  SelectAttributes from './SelectAttributes';
  Translations     from '../../../container/Translations';
)

this is an other example to demonstrate the benefit of using multiple import statements. you can better group imports, for example of a framework, by writing the group syntax. the example below showthe import of react, multiple material ui components and two app related components.

import React     from 'react';
import PropTypes from 'prop-types';
import (
  import { Add } from '@material-ui/icon';
  import { Chip, Divider, Grid, Typography } from '@material-ui/core';
)
import SelectAttributes from './SelectAttributes';
import Translations     from '../../../container/Translations';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment