All Questions
1,060 questions
0
votes
1
answer
58
views
React: "appendChild" not working because parameter is not of type "node" even though I am using the "createElement" function?
So in my react app, I have a SVG container and I am attempting to append a tag (which has paths inside it) to it.
I am referring to the SVG container with a ref.
My code does the following:
let ...
1
vote
1
answer
66
views
Event Listener Being Added Multiple Times in JavaScript, Causing Performance Issues
I have a problem where an event listener is being added multiple times in my JavaScript code, which is making my app slow.
The Problem
I am adding a dblclick event listener to all elements with the ...
1
vote
2
answers
87
views
document.body.setAttribute('aria-hidden', 'true') is ignored
I have a website with modals that work via React Portals and they work great, powered by a popular library. However, in one place, due to various sensible reasons, we have a custom modal that isn't ...
0
votes
0
answers
44
views
App.jsx does not render imported JSX components -> shows blank page in browser
I'm trying to switch my static website to React. I've never used React before so I'm clueless to what the error could be.
My current App.jsx looks like the following:
import React from "react&...
1
vote
3
answers
155
views
How does React update only the parts of the DOM that need updating? [closed]
How is React able to update only the parts of the DOM that require updating (because they've changed) as opposed to re-rendering the entire DOM?
From what I understand, regular HTML/Javascript web ...
0
votes
0
answers
33
views
Manipulating React DOM(input) from outside React Scope , Using a JS script
function translateInputText(targetLang) {
const inputElement = document.querySelector('the id of the html element');
if (inputElement) {
const originalText = inputElement.innerText;
...
3
votes
2
answers
181
views
Which is created first: the Real DOM or the virtual DOM?
When a React app is rendered for the first time, is the real DOM or the virtual DOM created first?
React with JSX is converted to React.createElement(). So, does virtual DOM creation start from here ...
0
votes
0
answers
22
views
Replacing text on DOM leads to React error: "Text content does not match server-rendered HTML."
I'm writing a Chrome extension to rewrite post titles and snippets on a forum website (e.g. Reddit). It's very straightforward so far:
const postTitle = document.querySelector("<MATCHING_EXP&...
-1
votes
2
answers
98
views
not able to scroll two elements simultaneously [closed]
in reactjs, I have a function that scrolls elements when given a useRef:
ref.current?.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center&...
0
votes
1
answer
52
views
React state does not update in component loaded at runtime
I have a component whose js file I load dynamically into a target repo. I load this the js file at runtime by adding a script tag that points to the file as the page loads.
I also have react state ...
0
votes
0
answers
35
views
Is there an opportunity to render an array with map method backwards in DOM structure in ReactJS?
For example, I have several items in an array. I render them with map so they appear layer after layer. In DOM structure it looks like you push elements into the array of a parent node. I want it to ...
0
votes
0
answers
117
views
How to scroll web page like Vimium?
I'm currently building a website that can scroll down or up like the browser already installed Vimium plugin. But I found that vimium scroll animation speed is different from window.scrollBy(), ...
0
votes
0
answers
50
views
React Table Row click annotation / popup for showing the selected row
I tried to show the popup message in the end of the clicked row, but it is showing popup by using unwanted height and width position i need to show it within the end of right side of the row.
i ...
0
votes
1
answer
55
views
React Component Not Rendering Data from API Call
I'm working on a React project and I'm having trouble displaying data fetched from an API in my Movies component. The data is correctly logged in the console, but it doesn't show up on the page. I ...
-1
votes
1
answer
35
views
how to use clickHandler with the default parameters
Problem: I try to make two routine on onClick; first routine is when accessed by click, second one is when triggered by direct calling. But i found syntax error when onClick handle function with ...