Category "javascript"

useSelector returns undefined - react-redux

I'm using react-redux. createSlice: import { createSlice } from "@reduxjs/toolkit"; const datatableSlice = createSlice({ name: "datatable", initialStat

How do I get all messages on a channel and post to hastebin? discord.js

I'm idealizing a doubt bot. In view of this, I must explain that at the end of the member's question, the channel must be closed and before that the bot must se

How to mock axios.create([config]) function to return its instance methods instead of overriding them with mock?

I'm trying to mock axios.create() because I'm using its instance across the app and obviously need all of its implementation which is destroyed by the mock, thu

Recaptcha onclick event

I want to fire a jQuery event onclick when the user selects the recaptcha checkbox. This is the code I have: <div id="reCaptcha" data-sitekey="XXXXX"><

Window.open() to trigger phone SMS/Call/Email app not working in Chrome on Android on Page Load - Using ReactJS

This is my code snippet. else if (item.title === 'Text') { try { window.open(`sms:${item.link}`,'_self') } catch

Laravel Vuejs Uncaught (in promise) ChunkLoadError: Loading chunk blogs-component failed

I have a Laravel + Vuejs project and while everything works fine on local development, 2 pages are throwing the ChunkLoadError. I have looked at other issues on

How can I aggregate/pivot this non-numeric data to show in a chart?

I'd like to show some data on a line chart. The source data looks like this: [ { date: 1, depth: 1, river: 'trent',

ESIDIR Error in NextJs, even if the code come from the official page

I need to learn Next.js for an interview, so I started to follow the tutorial published in Next.js official web page. It was all ok, until I arrived at this sec

How to use if statement in export default function in react.js?

Can you explain how to use if statement inside a functional component? I am trying to define a constant based on the value of an event being passed into props.

Accessing and updating canvas node callback inside of useEffect - React

I've created a canvas which is set to a state using a callback. circles are then created based on mouse x and y that are then drawn to the canvas state after cl

How to display OpenWeatherMap icons in weather application?

I'm trying to display weather icons from OpenWeatherMap in my weather application using JavaScript. I've tried using jQuery and other solutions I've seen online

Adding Google Ads Code in NextJS for Automatic Units

I'm working on a nextjs project and I have to implement the google AdSense code that is for automatic ads. So, my google ad code is just this: <script asyn

How to select and manipulate specific <li> elements present with pseudo-elements such as ::marker, ::before using javascript

I'm looking for a way to access the <li> elements present with pseudo-elements such as ::before and ::marker using Javascript. So far I'm not able to writ

How to change sticky element depending on scrolling through several section on JS/jQuery?

I need to change the sticky image (by changing class or changing URL attr) while scrolling past several text sections. Asana on their home page has an exact exa

How i send data from .js to .vue

How can I send data from a function in a .js file to a .vue File .js function editCoupon(id) { window['coupon_id'] = id coupon_id = id } File .vue expo

NodeJS re-run a command in a row

My question is like, i have a command in 10th line and i am trying to rerun it in 30th line. How can i do this? The detail of rerun command is in the code. Java

When a call made to Word.run function, I am getting 'Word' is undefined in word 2016

Issue: Here I am using an word add-in in word 2016. When a call a function which uses Word.run is giving an error as 'Word' is undefined. The add-in file is wor

React Click Counter: Updating State of just one element

This should be pretty simple, but I can't figure out how to do it. I have a component with multiple buttons, each with a "count" value, set with state. When a

Javascript encodeURI not work well with csv

I'm trying generate short CSV by the code bellow : Source const csv_content = `"Hello"þ"World"þ"#"þ"123"`; const href = 'data:attachment/csv;c

How to place an image over iframe using proper css

I am trying to place an image(which is a close button) on iframe at the top-right corner, the iframe and image are loaded from js function in angular, I have pl