javascript - import React, { Component } from 'react'; What is the {} part? -
pretty simple, can explain me part between curly braces is?
i understand add , can remove react "extends react.component" not sure use of or reasoning behind it.
it allows import single member if require. in case provided may not useful other ones. example:
// constants.js export const test_const = 'hola'; export const other_test_const = 'yo'; // somefile.js import { test_const } './constants'; console.log(test_const); // output: 'hola' hope helps little. theres great description of module system on mdn.
https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/import
Comments
Post a Comment