Ecmascript-6 Questions
Ad
showing the creators name of the post in react using post list
I'm creating a list of posts with the creators' name in react and
ReactJS: How to prevent duplicate values in array.push?
While selecting one option in the select box at that time rest of the options are become multiple values. how can i prevent this duplicate values
Filter and assign object from an array to another object
I have specific object that i need to get from another array which is the hexcode this is the data that i'm filtering
How to import TrackballControls from three.js module using react?
I am using react js boiler plate (create-react-app) and imported three.js. i am trying to use trackballcontrols for a particular project but it
Adding new object in array in existing array
I have a crud functionality in my react application using hooks and es6. i'm using antdesign list component as well. in my add function, after
difference between ...this.state and this.state
In my react application i am passing parent's state to child as a prop like so: <child parentsstate={...this.state} />
firebase.auth.EmailAuthProvider is undefined
This is how i import firebase into the project: import firebase from 'firebase/app' import firestore from 'firebase/firestore'
JavaScript - Add to Class Assignment After Class Initiation
I am trying to manipulate an already initialised javascript class. the class is a http request library and i am trying to create a "base"
How to properly Capture JavaScript Click event to Hide and Show a Div?
I have 1 input area and one popup area when i click to input, the popup will show, and when i click anywhere else in the body (except popup and
How to run index.html on Node.JS
I need to run a website on a server. i installed node.js and created a server.js file in the project folder and read the index.html file there.
Ad
How to remove elements from array if not matching?
I am trying to delete all elements that matches @b.com, but it returns an empty array even if i remove the !, which
How to call a class and setState in one onClick(ReactJS)
I'm pretty new to react and i was wondering how i could call a function inside a class (so like this.handlechange) and an arrow function with a
Leaflet never loads leaving the screen blank with no errors
Im trying to build a reactjs app that has a map, i've wanted to use leaflet because of its popularity and the fact that its free
Parameter Missing from frontend request to backend
I am currently getting this error: actioncontroller::parametermissing in userscontroller#create param is missing or the value is
Angular2: No Directive annotation found on MyComponent
I'm trying to put together a little angular2 app: i'm not using typescript, but rather regular es6 with babel my files looks like
How to config webpack to transpile files from other lerna packages (ejected from create-react-app)
I'm trying to build a lerna package with a create-react-app package and a simple component library. my component is as follows:
Adding library function for sorting array gives undefined
I am trying to add a library function for sorting items in an array. though i got link and way, but when trying to make a library function, this
JavaScript array comparisions and display values from another
I have a case where i need to compare between two arrays and display values from another.; for example, i have two arrays: let a =
Disable Button When Deleting in Redux and React
I have here a problem disabling the button when deleting. right now, it disables all the "delete" button of all images. i only wanted to
Merging two array of objects with foreign key id
I am making 2 api calls to receive two sets of data. const callone = await api('get', `${baseurl}callone`); const calltwo = await
Javascript Promise within Class
Fun with promises today ... i'm trying to figure out why i can't refer to this.promise to resolve it with another method, it's always
Ad
Response from Express is undefined and pending (React frontend)
I'm writing a program where the user inputs a number into a react frontend and a node.js express backend gets all possible prime numbers under the
Can I develop Node.js (Express) app in both JavaScript and TypeScript together?
I have node.js project (express rest api) written in javascript. we decided to rewrite whole project to typescript. is possible to do it slowly,
Get the key names of the object with value equals to something
Is there a better way to get the key names of the object with value equals to cat? import { topairs } from 'lodash'
regex for group of square brackets and comma javascript
I'm trying to construct a regular expression which i can use to replace all instances of "],[" with just "," in a string. i'm stuck on
remove last item from array and rerender in react failed
I want to remove last item from array and rerender but i seem can't get it to work without using filter. but in my case i don't think filter is
Typescript Object is possibly 'null' focusing using ref in react
Typescript is still giving me error object is possibly 'null'.ts(2531) even though i do this myref &&
Invoking .find() on empty array leads to error
I'm working on small app and sometimes my array producttypes has data, and sometimes it doesn't.. and i've noticed when
Advanced filter and reducing
I'm receiving this json from my api, i'm trying to transform it into a usable format for my form ( it will be a list with checkbox)
Assign a new key to each object in the array with a unique id based on the index of the object in the array
I am trying to assign a new key to each object in the array with a unique id based on the index of the object in the array. when i click a
Custom Controller code for Strapi Beta (3.0)
I have some code from the previous version of strapi that works, and the beta version of controllers is much different. there is multipart /
Rendering the content asynchronously in reactJS
Basically i have a set of dynamic tables that are being displayed based on the values passed. if there is an empty array passed, it should show no
Ad
Convert Node.js files to ES5
I have node.js script files which i am trying to re-use inside an asp.net application on ie 11. i follow below steps to use them on ie
How to have a condition in react hooks
I'm trying to load a bootstrap modal on page load unless a cancel button is pressed. the way the functionality is supposed to work is that once
How do I display data fetched from firestore to a boostrap table in reactjs? I'm able to fetch but cannot display with the standard way of doing it
I'm trying to fetch data from the firestore and display it to a bootstrap table with reactjs.i'm able to get the data and store it in a map, and i
Proper way to require exported methods into a class (prototype?)
I've ran into a little problem while refactoring my stuff... problem: i got a single class file with 1.1k lines and ~10
Regex to convert camel case to normal sentence while changing some to uppercase
I am trying to convert to camel case words to a normal sentence text . for example :
Using es6 shortcuts to reduce number of lines in code snippet
Is there a more concise, prettier way to write this snippet of code? learning es6 syntactic sugar and was wondering if i can reduce the number of
Access my ReactJS project from other devices in LAN
I want to access to my reactjs project from other devices in the lan network. i already tried 0.0.0.0 for the host address, but i still can't
How to remove variable from graphQL query if it's empty?
How do i omit the variable searchquery if its value is an empty string, and have this logic inside of template literal? code:
How to build new object using keys from array of keys and values from another array of objects
I have this array of keys: ["newid", "newfirstname", "newlastname"] and i have also array of objects that looks like
"Removing" multiple properties from an object without mutation
I'm searching a for a way to create a function. in which i can pass an object and an array of properties (keys) i want gone. that function will
How to properly throw an error from the promise
I have one function, which returns promise: updatepassword(currentpassword: string,
Ad
Redux state set object to object
I have initial state like: let initialstate = { items: [ { name: 'a' }, { name: 'b' }
Why does new Array(3) function not return 3 undefined values in an Array?
I am trying to create multiple div tags based on the value passed on to the function. iso to do that in the function i create a
Custom dependencies under "nodejs/" directory can not be resolved from aws-lambda
I am trying to import custom dependencies from lambda layer but is not working. environment: nodejs8.10 i have a layer which
How to search for a particular matching property value inside an array of objects?
I want to search only in name property of the list of json objects. this is the json array - combinedarr = [ {
ReactJs key-error in rendering <option> dynamically for <select> input using map()
To practice reactjs, i'm trying to develop a small application. i am unable to solve the key-error. what i'm trying to do:
Getting Error regarding :Cannot read property 'length' of undefined
I don't know why its giving length undefiined and other one is setdailydata is not a function const
How to give date format to react-csv column
I am trying to export data as csv file . i am using react-csv library for it everything is working fine but i am face to date format.
assigning a static class attribute triggers error on babel
I am trying to compile a js class file with babel. the class has static attributes which i initialize on the same line. when compiling i get the
How could I store multiple values to one reusable variable - reactJs
I'm working on small react app and my dropdowns looks like this: <custdropdown disabled={ isplayerloaded ||
How could I remove some entire object from an array inside another array when it has some property value?
I need a function to delete some entire object inside an array: let selecteditem = { linkid: 1 }; let sindecs = [ { estado:
Strange behaviour of reduce method in JavaScript?
I was trying to create an even number array of fibonacci series using functional programming - below code
Ad
Shared state in ES6 vs CommonJS modules
I can share state via commonjs modules, but not via es6 modules. i'm wondering why, and want to know how to share state via es6
Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL in the protractor
I am using a protractor and ecmascript 6 to develop end to end tests. but when the test is finished i see the error: message:
Parsing array of objects to format data
I have an array of cities with this structure (given from the cms): const cities = [ { city: 'genova',
Filter an array of objects with multiple elements with their values using javascript or lodash
I have an array of object as below. const data = [ {id: 1, name: 'peter',age: 21, gender: 'male'}, {id: 2, name:
Javascript automatic semicolon insertion for do-while statements
Since es6, a new case has been added for rule 1 of
typescript using properties class for multiple calles
Ive create a class which needs to call to other class and get data e.g import { sc } from "./svc/service"; export
Image doesn't show up in reactjs when using background: url()
I'm new when using reactjs, i quite confused as why the image doesn't show up in my code. i'm using background: url() so it easier
Create new object out of huge array of objects
I retrieve a huge array from the server (contains 2000+ objects). the structure of this array is like this: const arr = [ {code:
Create React Dynamic Forms
I am trying to achieve a dynamic form using react hooks and .map(); what i have achieved so far is to generate the form static like in
What is this syntax in Node.js and PostGres
Hi came across this syntax in a node.js application, in which we are making a select query to our postgres database.
TypeError: values.map is not a function
I am trying to map the object but in meantime it gives me the following error: typeerror: values.map is not a function.
Ad
How to access value from child to parent component in react
I am trying to access child component value in parent so there i want to use it for update the state . actually in child component i have dropdown
Getting all elements on the page with javascript
I wrote a web page crawler that successfully crawls a web page and grabs the data of one job posting using puppeteer. i'm now trying
Async Function throwing errors and I cant see them
I'm new to async functions and even node.js. i'm trying to crawl a website and grab some data from it. when crawling the website my code randomly
unsubscribe to an Observable created by of
When i create an observable and i am done with it i unsubscribe it directly const data$ =
For loop addition assignment for variables in post statement
I declared multiple variables in a for loop, and i would like to increment my variables in the post statement. i understand this is not the best
Why is this working: updating array element in state with spread operator
When reading react cookbook i've stumbled upon a code snippet, this function gets called when user checks a task as completed in a todo list:
Spread Operator not working while importing from const variable
I am facing some weird problem while import a const value in react. actually, i am exporting a const which is not related to react like
How to fix 'undefined is not an object' error in react native
I am attempting to move my react-native app code to be in a more structured manner. originally, i had all of my firebase functions inside the file
What is the default value of variable in for...of loop?
What will be the default type of the variable in for..of loop.
React map over the array object
I'm quite new with react stuff, what i am trying is to generate some dynamic stuff using .map() this is my component: import
How can I pass two option arrays for the same dropdown component in react js?
I want to reuse my dropdown component in two other containers by passing two different set of array. example: one
Ad
Get consolidated data from all the child components in the form of an object inside a parent component : React JS
I am implementing a setting page for an application. for each setting i have implemented a slider that has enabled(green) or disabled(red) state.
How can I break out of this Promise for loop?
Edit: i know how to get it working using async/await but unfortunately, i can't use it as it's not widely supported (especially
How to add a button inside a react bootstrap table?
I'm trying to add a button to a cell in a react bootstrap table with the following is my code: import react, { component }
React component as backgroundImage
I am using react-icons in my project and what this awesome package offer is to have all free fonts images in one place and served as react
Why does the output of the function 0 even though 0 isn't in the range?
I am a python developer learning javascript and node.js. i was practicing some javascript and one of the things i miss in python is the
How to implement on-event handler in my javascript class (ES6)
How can i create my own "on" event handler in my class? for example, websocket has multiple "on" event handler as follows. var ws
Grouping array based on special character count
I'd like to write a program that takes an array of strings and returns an object that groups those strings into arrays based on the number of
Find the sum of array element in react native
Here i am mapping financialtransactiondetail array and populating data. values are coming fine. now i have to get the sum of
Mocking 'os' nodejs module issues
I'm currently facing some difficulties mocking the 'os' module in nodejs. i'd like to mock the 'networkinterfaces' function of the module to
Handle exception when clicking a link in react
I have an href link displayed in react-table, which calls a spring backend application. sample code of the column header: '',
Destructure Array and assign to property object in one line
I have these javascript lines : const record = {}; const parts = ['deviceid-abc', 'messagesid-def']; record.deviceid = parts[0];
Ad
Implementing two-dimensional arrays with Maps in Javascript
I am using a two-dimensional array in some code which i would like to replace with a more suitable data structure in context, namely a
Javascript - Workaround for flatmap
So i was looking for some workaround for flat map as it doesn't work on ie and i find this one: but i don't really understand why does it work
Is it possible to extract object key two times for the same key?
I have this: function test1() { return new promise(resolve => { return resolve({ a: 1 }) }) }
Sails.js how to call functions within a controller
Getting my hand dirty in sail.js (and node). versions $ sails --version 1.2.4 $ node --version v12.16.1
React constructor declare props crash intellisense vscode
Any raison why i cant declare my default props like this ? am new in modern front-end and am come from js vanilla, sorry if seem hard to me
How do i change property of nested object in State?
State looks like this for example { ownrecipe: {name:""} } now i need to change name property, this doesn't
Extract a constant from a constant (accessibility of variables)
With react native and react navigation, i can change my title with navigationoptions : const forumscreen = ({
How can I convert Array of Objects into Array of Array of Array
Hello everyone i'm beginner in javascript i'm trying to convert from array of objects into array of array.i have tried some methods like
Map typescript parameter: Binding element 'contacts' implicitly has an 'any' type.ts
I have this code taken from a javascript post and i would like to use it in typescript but i get an error in: const contacts = ({contacts})
How to transpile node_modules folder using just babel 7?
Trying to unit test reactjs application using mocha but getting error from es6 features (import/export) used inside node_modules
Async reduce returning promises
I have an array of objects and i have to add one property on each of the objects coming from and async function i am doing an array.reduce
Ad
How to perform array join in Node.js efficiently/fast similar to MongoDB $lookup?
I want to perform a $lookup in node.js similar to $lookup aggreation from mongodb. i have a solution but i'm not sure how fast it
Update redux state object property
How do i update the property of an object in redux and preserve the rest of the object.. const appreducer = (state = initialstate,
Ad
Blog Categories
Ad