Category "ecmascript-6"

How to replace /n to linebreaks in react.js?

I am trying to replace every /n to a <br> tag in ReactJS. In my note.note object there is a string with multiple /n in it. example note.note: test\ntest

Use reselect selector with parameters

How do I pass additional parameters to combined selectors? I am trying to • Get data • Filter data • Add custom value to my data set / group d

Re-export default in ES 6 modules

In ES6, is it possible to shorten the following code. I have an App.js file and an index.js. index.js import App from './App'; export default App; Somethin

ES6 - Finding data in nested arrays

In ES6 using find or filter I'm quite comfortable iterating through to find an element in an array using a value. However, I'm trying to get a value from a par

Typescript: Cannot use import statement outside a module

I have a .ts file in node js (latest version of node.js for 07.10.19) app with importing node-module without default export. I use this construction: import { C

"Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6

I'm using ArcGIS JSAPI 4.12 and wish to use Spatial Illusions to draw military symbols on a map. When I add milsymbol.js to the script, the console returns err

How to mock a ES6 singleton class with Jest?

I have a dependency that is a singleton class like so: // dependency.js class Dependency { foo() { ... } } export default new Dependency(); I'm trying to

Vue.js: How to specify props in single file component?

I'm defining a single file component I want to use props option on that component. But where can I add the code? <template> <div class="hello">

check if function is a generator

I played with generators in Nodejs v0.11.2 and I'm wondering how I can check that argument to my function is generator function. I found this way typeof f ===