Category "javascript"

How to remove repeated code for ternary operator?

I'm receiving the data where a lot of fields are null, and I have to populate something if the field is null. like in the below data { //... IGM_ETD: '202

cy.intercept randomly not work when "delay" is set

I use cy.intercept to mock an api. But I can't understand why the requests are not always intercepted by cy.intercept. The failure is random. Here is my interce

What is the proper format for HTTP POST Dynamic Zone data with Strapi API?

I have a Strapi user collection that looks like this. I am trying to use the API to create a new user with the "AdditionalInfo" dynamic zone filled with "Stud

pass data to child component when clicked on card in parent component ( card has image name id and more info ) angular

I want to pass data when clicked on the card(card has images, id, name, and more) from the parent(nfts) to the child(main) component and render the information

ReactJS push to state array replaces every exisitng value in array

I want to push an 2d array into the end of a state. But somehow, when i log the state every time it changes with a useEffect, i replaces every existing array wi

Discord bot won't join the music channel a user is in

I was trying a tutorial yesterday to make a personal music bot but the code to make the bot join a channel that the user is in upon using the "play" command isn

How do I handle res.download(pathname) on frontend(ReactJS)

I have written a code on my server(NodeJS) that will send a .csv file to the frontend with express res.download(path). I would like to know how I can handle the

Create and Update a List Item with Javascript in Sharepoint

Hello i'm an beginner and i try to create/update a SP List with Javascript with an condition. if a list entry with current users email exist then i will only u

How to Get the Contents of a Custom Element

I'm creating a custom element that will be able to convert its contents from markdown to HTML. However, I'm not able to get the contents of my custom elements.

How to link the imported dependencies of module created by vm.SourceTextModule to it?

Let's say we are creating a module called app by constructing a new vm.SourceTextModule object: const context = { exports: {}, console, // custom console o

How to put data inside a customize state in for loop in functional component

I get the data from the API as follows: [ { "GroupA1": [ { "code": 10, "name": "item1" }, { "code": 11,

Update webpack 4 to webpack 5 on an existing create-react-app ejected with react-app-rewired

I have an existing old react application, created with create-react-app and ejected with react-app-rewired. I'm updating the deprecated dependencies. I've alrea

REACT JS - Firebase: Data type NUMBER

Simple and quick question (And yes I google it first, got mislead to phone number verification and other stuff), Anyways! back to the point Why when I input dat

Angular/Leaflet/OpenStreetMap - clicking on pin for pop-up throws error about an already defined service variable, doesn't display binded pop-up

The error appears in the browser, when I click on any pin. No pop-up is displayed, nothing happens, just the error in the console. Below you will find the comp

What's the difference between onClick ={ () => function()} and onClick = {function()}?

What's the difference between this code: <button onClick={()=>props.submitHandler(searchInputValue)}>Submit</button> and <button onClick={pro

How do I configure parcel to exit build with an error if eslint does not validate

I'm building a react app with parcel. I have an eslint config set up that I like, and use VSCode tools to catch eslint errors and fix them as I code. The app bu

Page not reloading on navigate("/") (svelte-routing)

I am working on a website and there for using Svelte and the svelte-routing library . The svelte-routing library has a method called navigate(path). I use this

Incorrect use of ternary operator

I want to display a progress bar and its percentages, but only while bar is less than 100% completed. This is the code I'm using: return ( <>

Why can't I connect to mongoDB atlas?

I am new in MongoDB, all my life I used MySQL. I have created an account in atlas, set the IP to my IP and created a user and saved the password. here is my cod

React useQuery called multiple times when dropdown is opened

I am using "react-query" to call an API from a component . For the purpose of this question , I am returning a mock response from the API . Every time , I open