Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

484 questions
0
votes
1 answer

Am I using Redux correctly?

this is just a question, I'd love to double check if I'm doing things right. I'm coming from ages of different frameworks, and I def want to avoid bad practices in the early stage. I'm using this boilerplate:…
Snick
  • 1,022
  • 12
  • 29
0
votes
0 answers

Reactjs: Why my props aren't being updated?

I need to update my props in order to render new data. I have a view with a list of dealers for a casino game. That list is OK, the problem comes up when you try to add a new dealer, the dealer doesn't display in the view, yo have to reload the page…
Non
  • 8,409
  • 20
  • 71
  • 123
0
votes
2 answers

defaultProps overrides delevert props

I have an simple react component that i send a bool prop to like but the prop don't get changed inside the component and is always true even if i pass it in on the element @Radium export class MenuItem…
VeXii
  • 3,079
  • 1
  • 19
  • 25
0
votes
1 answer

Selectively assign object properties in ES6/7

Is there a short syntax in ES6/7 for assigning just some selective properties of an object to another? For example I want to do this const a = { x: b.x, y: b.y, z: b.z } it's ok with 2-3 properties but with many more it will become redundant.…
KwiZ
  • 1,364
  • 2
  • 15
  • 25
0
votes
1 answer

What is the most concise way to bind an ES7 async callback to its parent scope context

I want to write code like this using ES7 async callbacks. class Foo { bar(app) { // const that = this app.on('something', async function() { await this.baz() // `this` is `app`. I want it to be the instance of Foo (`that`) } …
vaughan
  • 6,982
  • 6
  • 47
  • 63
0
votes
1 answer

Angular 1.4 using ES6/ES7

I am starting a new project and want to use Angular 1.4 with ES6 classes for controllers, services, and directives. The best looking code I could find tended to use some sort of decorators, like @Component, but that seems to be an experimental…
Kip
  • 560
  • 7
  • 16
0
votes
1 answer

Why this Object.observe notify example does not work

I am trying to run the example posted here http://www.html5rocks.com/en/tutorials/es7/observe/ under notifications (using Thingy) to use Object.observe feature. Here is the code snippet I ran: function Thingy(a, b, c) { this.a = a; this.b =…
-1
votes
1 answer

Adding 1 additional object to the map function ES6

I have a code in place which looks like this - mapFn={response => (response.data && response.data.map(secret => ({ label: secret.secretName, value: secret.id })))} I need to add one more…
-1
votes
2 answers

How to compare two objects and change the key name?

compare headerObj(field_key) and dataObj(key) and form the result with label from headerObj const headerObject = [{ label: 'Code', field_key: 'code' }, { label: 'Worked Accounts', field_key: 'workedAccounts' }, { label:…
-1
votes
3 answers

Porblem on Getting Array Inside of Array

I have a problem on an object inside of an array and I wanted to display only that as an array. data1 const data1 = [ { "id": "01", "info": "fefef", "sub": "hieei", "details": { "data": "fruits" } }, { "id":…
Gray Singh
  • 320
  • 1
  • 11
-1
votes
1 answer

src\components\Home.js Line 6:10: 'Container' is not defined react/jsx-no-undef

import React from 'react' import styled from "styled-components"; function Home() { return ( home ) } export default Home the error comes src\components\Home.js Line 6:10: 'Container'…
-1
votes
1 answer

How to flatten an hierarchical array of objects + sum values from childs in JS

This one gives me headache, I don't know how to achieve restructuring this array of object: const obj = [ { id: 10, name: "foo", // parent value: 20 }, { id: 11, name: "foo - 1", // child value: 2 }, { id: 12, …
-1
votes
2 answers

How to change indexes keys an array of object in JavaScript

I have an array of object , [{name:'abc'},{name:'def'},{name:'ghi'}]. When I loop map() on this array I am getting array like [0:{name:'abc'},1:{name:'def'},2:{name:'ghi'}]. I want to change index number to string values like…
JS Guy
  • 11
  • 1
  • 2
-1
votes
1 answer

What is the purpose of for(;;) in the following code snippet?

So, Iwas reading through some Javascript Question answers on CodeGolf to try and improve my understanding of Javascript a lttle bit, & noticed this answer in the following question Generate Green Spraypaint Patterns Within the Answer I spotted a for…
-1
votes
1 answer

How to sort alphabetically an array of object depending on name and a query string?

I have the following function: const sort = (query) => (choiceA, choiceB) => choiceA.name.toLowerCase().localeCompare(choiceB.name.toLowerCase()), It is used as follow: newSearches = newSearches.sort(sort(query)); For example, in this example,…
Dimitri Kopriwa
  • 13,139
  • 27
  • 98
  • 204