0

I am reviewing an app build in Vuejs (I am not a vue developer), so be patient with me.

I found this line of code:

const {property, $rxFirebase: {actions: {properties}}} = this

I guess this works as in other languages. "This" is assigning values to the object in the left.

I am trying to read also {sources: {properties}}, so I have added the code like this:

const {property, $rxFirebase: {actions: {properties}, sources: {properties}}} = this

But when I build it, I get an error:

Module build failed: Duplicate declaration "properties"

Any ideas?

1 Answer 1

1

This is not just assignment its destructuring assignment. This line:

const {property, $rxFirebase: {actions: {properties}}} = this

is equivalent to

const property = this.property, properties = this.$rxFirebase.actions.properties;

So you can not add another properties variable because it is already declared. You should add different name for second properties declaration, like this:

const {property, $rxFirebase: {actions: {properties}, sources: {properties: myProperties }}} = this; // where myProperties some name for variable
console.log(myProperties === this.$rxFirebase.sources.properties); // true
Sign up to request clarification or add additional context in comments.

1 Comment

can you help me with this question: stackoverflow.com/questions/51549695/… it seems a long question, but actually is a direct question, how to get the properiest list count. I just show the code related before asking that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.