B
B
beefront172017-10-19 16:52:42
JavaScript
beefront17, 2017-10-19 16:52:42

Who can explain how the component is implemented?

Good afternoon! Please explain how the Polyline component is implemented in this case .
Especially, it does not reach what these constants do (and what they are for). How are they passed through the key?
import {MAP, POLYLINE} from "../constants"

polyline.setMap (this.context [MAP])
     this.state = {
       [POLYLINE]: polyline,
     }

Who knows please explain!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Koch, 2017-10-19
@beefront17

import {MAP, POLYLINE} from "../constants"
The same as:

import * as constants from "../constants"
constants.MAP // {MAP}
constants.POLYLINE // {POLYLINE}

And further:
POLYLINE = "string";
state = {[POLYLINE]: polyline} // state = {string: polyline}

N
Negwereth, 2017-10-19
@Negwereth

https://developer.mozilla.org/en-US/docs/Web/JavaS...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question