ES6 - Destructuring

0 votes
267 views
added Feb 27, 2019 in ES6 by LC Marshal Captain (25,790 points)
// instead of 
var Router = require('react-router').Router
var Route = require('react-router').Route
var Link = require('react-router').Link

// to
import {Router, Route, Link} from 'react-router';

 

1 Response

0 votes
responded Mar 6, 2019 by LC Marshal Captain (25,790 points)
//API
// "result": {
//         "_id": {
//             "$oid": "5c7cd95997468a7fc56eef3e"
//         },
//         "nid": 1486969,
//         "mid": 1068533,
//         "uid": "75517",
//         "title": "FULLY RENOVATED Semi D Tiara Heights Sepang",
//         "changed": 1551685977,
//         "state": "Selangor",
//         "district": "Sepang",
//         "asset": {
//             "project_name": "Tiara Heights",
//             "state": "Selangor",
//             "district": "Sepang",
//             "street_name": "JALAN TIARA HEIGHTS",
//             "tenure": "Freehold,Leasehold",
//             "property_type_group": "l"
//         },

const { result: { title, state, district, changed, asset: { project_name } } } = ColumnMainData; 

<div className="detail-info-pre-1">{project_name}, {district}, {state} </div>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...