Category "javascript"

how to redirect from a utility function in remix run

I am using Remix-run and i want to redirect to my login page from a auth utility function. but it doesnt work. here is a similar function to my authentication u

NHOST TypeError: (intermediate value) is not a function

The following code from NHOST (https://docs.nhost.io/get-started/quick-start/javascript-client): import { NhostClient } from '@nhost/nhost-js' const nhost = ne

How react binds events to elements generated by map

When I click discountKeyboard,it reported a mistake: Warning: Functions are not valid as a React child. This may happen if you return a Component instead of f

Get values in JSON object from html input text and label

I have a HTML by which currently getting the values of input elements in loop in an array. But now I want this in json object with its label. Below is my html

simple task javascript buttons in html

Can someone please help me make a button which prints thank you when clicked? I know there are lots of ways to do this but in my circumstance, I need to use an

React Native SafeAreaView background color - How to assign two different background color for top and bottom of the screen?

I'm using SafeAreaView from React Native 0.50.1 and it's working pretty good except for the one part. I assigned the orange background color to the SafrAreaVie

fetching from an api - state react context

I am working on an app that fetches current weather for a specified location. I want to display current time but i have to use "slice()" method to get rid of th

Cypress custom command is not recognized when invoked

I've created the following custom command in my cypress/support/commands.js file. Cypress.Commands.add("login", (username, password) => { cy.request({

How to use BigInt exponentiation with Babel?

Consider this: const a = BigInt(2); const b = BigInt(2); const c = a ** b; Babel will convert this to: var a = BigInt(2); var b = BigInt(2); var c = Math.po

Get an active route with react-router in ReactJs

I am creating a project using reactjs.In my application i am getting the active route using this: this.context.router.isActive but getting undefined, i am us

Find the Max and Min element out of all the nested arrays in javascript

I have a array like so: var arr = [[12,45,75], [54,45,2],[23,54,75,2]]; I want to find out the largest element and the smallest element out of all the elemen

How to reset a date in Firefox input[type=date]?

Firefox v57.0.1 supports the attribute "date" for the HTML input tag. I would like in jQuery to reset the date value when the user click on a radio button like

How to get document by current signed in user in Google Firestore

I am trying to get a specific document that is created when a user signs up. I made it so that when the use signs up, their firebase user ID is the name of the

Pass dynamic value into react-i18next useTranslate

So I have a value I am receiving from an endpoint and I'd like to pass it into my translate command. So this is what I have currently: ${t('translation:user.for

How do I make IntelliSense in VSCode show completion from other files?

Background: I wrote a game in Swift. Now I want to translate the game logic (the model) part to JS so that I can write another version of the game which can be

How do I configure absolute paths for imports in TypeScript based React Native apps?

In order to avoid '../../../../' style relative imports in a TypeScript based React Native app, I would like to configure the app so that I can use absolute imp

Property `user` does not exist on type `Session & Partial<SessionData>`

I had a code in javascript and I'm trying to convert it to typescript route.get('/order', async(req,res) => { var sessionData = req.session; if(typ

VS Code: Lit custom element not rendering properly

I've copied/pasted the code from lit.dev's playground page to troubleshoot and attempt to get Lit running in VS Code before working on my own project. I was abl

Amplify delete user's own account after OTP verification

Is there a way to delete a user's own account only after OTP verification in order to confirm his identity? The OTP can be sent to either email or mobile number

Images are not displaying in webpage grid from uploaded image folder

I'm trying to make a memory match game using reactjs. I have my components and other files in src folder. index.html,style.css and image folder(img, with all im