Relative Content

Tag Archive for javascripthtmlcssreactjs

getBoundingClientRect() method returning different top value in different devices

In reactjs, I am displaying a cursor before the current letter in a typing test app. I am using the current letter’s absolute positions to position the cursor. It is working, but when used in mobile phone there is slightly smaller value of top position of the letter
const rect = spanRef.current.getBoundingClientRect(); setCurrentCharacterPos({top: rect.top, left: rect.left});

What I want to do is I want to make a circle and find the pixel coordinate on the circle circumference to lay my images on that circle div

So Hello everyone, I have a question that how can I find the pixel coordinates on the circumference of the circle div, because I want to place elements on it dynamically using React/JS by clicking that element, where when I will click on the element it will automatically come on the circle circumference and when I will click more, more will be added equidistant from each other fully dynamically.

React Navbar Mobile Menu Background Does Not Cover Full Page Width

Problem: I’m having trouble with my React Navbar component. When I decrease the screen width, the mobile nav menu opens up, but the #242424 background doesn’t cover the entire width of the page. I’m not sure what I’m missing. My Code: Navbar.js: import React, { useState, useEffect } from ‘react’; import { Link } from […]

adding and cloning column in a table using react

I am new to React, when I click the add button it should create a new column with text box and no values in the text box
add button present inside flow data column.
Clone should clone the flow data column.
I debugged but still no luck.
Providing the code and stackblitz below. Can you let me know how to fix it.

filtering the search results base on the chip inputs

I am new to react in the below array there are two items with – symbol.
when I search it should return only two values but why its returning all the values.I debugged but still not able to resolve it.
Can you let me know how to fix it
Providing code and fiddle below

React questions for proper understanding of the topic

import { configureStore, createSlice } from ‘@reduxjs/toolkit’; const formSlice = createSlice({ name: ‘form’, initialState: { name: ”, dob: ”, }, reducers: { setName: (state, action) => { state.name = action.payload; }, setDob: (state, action) => { state.dob = action.payload; }, }, }); export const { setName, setDob } = formSlice.actions; const store = configureStore({ reducer: […]