Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
Destructuring in named export?

In javascript,I import a named object like this:

import {my_object} from './my_js.js'

Is some sort of destructuring happening in this above mentioned import statement or using curly braces is just a requirement for importing named object?

thanks in advance

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Although the syntax looks very similar to destructuring, and the operation being performed is somewhat similar to destructuring (in that it takes the my_object binding from the namespace and puts it into an identifier), it's something quite distinct. For a couple of examples...

With destructuring, you can destructure nested properties of an object. This is impossible to do (in one statement) with imports.

With destructuring, you can put the property into a different variable with a colon. With imports, as must be used instead.

const { prop: propIdentifier } = obj;
import { theName as theNameIdentifier } from './somefile';

using curly braces is just a requirement for importing named object?

Exactly.

There are things you can do with destructuring that you can't do when importing, and there are things you can do when importing that you can't do with destructuring.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!