All Questions
Tagged with jsx javascript
4,887 questions
0
votes
1
answer
24
views
shadcn chart has no space between label and value
The issue I'm facing can be seen on the image, essentially some bigger values don't have any padding in between value and label, I'd like to know how I can make it at least 2px
Image:
Part of code:
...
0
votes
4
answers
80
views
Render a list of jsx components in react [closed]
I have a list, containing some jsx components like components:
components = [
<span className="c1 c2" onClick={() => console.log("test")}>...</span>,
<span ...
0
votes
0
answers
30
views
Otp is not verifying
Tech stack being used: Next js jsx, Prisma, Postgre, Zod, Nodemailer, Crypto
Issue: When I sign up and fill in the required data (Name, email, Password), an otp (one-time password) is generated and is ...
0
votes
1
answer
52
views
Error: an Illustrator error occurred: 1346458189 ('PARM') (illustrator v2024)
I have been getting these errors very often in almost my simplest scripts for a long time. I am getting this warning even though I have tried all the alternatives thinking it may be in the coordinate ...
3
votes
1
answer
46
views
Want wrapped content to expand only downwards with CSS
I have a searchfield that autofills with different quippy lines that may or may not need to wrap to fit all the words. This is anchored to a centered parent that makes sure that the searchfield ...
0
votes
1
answer
45
views
conditionally add prop to a jsx element [duplicate]
I have a react app and am trying to pass down a prop to a jsx element based on a condition. The element in question is an anchor tag and if the condition is true I would like to pass a rel="...
0
votes
0
answers
23
views
How to render components exported from mdx in Astrojs?
I got a mdx file like this and I want to render the foo component in somewhere else.
---
title: Hi, World!
---
export const title = 'My first MDX post'
export const foo = <h1>adsf</h1>
# ...
1
vote
2
answers
38
views
Error while styling background color of an span in React
I'm following Jonas Schmedtmann's full-stack crash course, and everything is fine. But in this part, I'm receiving a React runtime error (TypeError: Cannot read properties of undefined (reading 'color'...
0
votes
0
answers
24
views
React/JSX-runtime Module not found
Currently working with a React project 17 and after adding the React-Timezone-Select package I've got a build error saying the following :
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\...
1
vote
1
answer
48
views
Typescript Classes use a static method in a base class typed for any children classes
I am trying to write a wrapper for web components which allows you to use them in JSX by referencing their key; implicitly this will also register the custom element if not done so already so that you ...
1
vote
1
answer
91
views
How do I calculate the color RGB code in a color picker?
I'm trying to make a reusable color color picker component in react, I want to calculate the RGB color code using the mouse coordinates on a 256 by 256 div, the div has a white background color and it ...
0
votes
1
answer
88
views
Can we use React Hooks inside JSX component's callback like this?
Does this count as breaking the rule of hooks? It doesn't show the error/warning 'Error: Invalid hook call' and the code works normally. useEffect also mounts only once
1.✅ Call them at the top level ...
1
vote
1
answer
56
views
How to pass a React component to a component and use it inside the component as a component?
I have a Button component that allows some props like variant, active, size etc. to change its styling.
What I want is, passing the Button component to another component and use it there as a normal ...
-1
votes
2
answers
98
views
What exactly can be put inside JSX curly braces?
I just stated learning React not too long ago. I was first confused why can't we put if statements inside JSX curly braces. I came across this question if-else statement inside jsx: ReactJS and ...
1
vote
1
answer
46
views
Force ReactJS routes index to reevaluate before redirecting on login
I wish to conditionally include authenticated routes on the routing index of my ReactJS application based on whether a token exists in the user's local storage. However, for this to work, the routes ...
1
vote
1
answer
48
views
Switch component is not working after switching from Checkbox
I was using Ant Design Checkbox earlier to check and publish the comments and it was working fine with no errors.
<Checkbox
key={record.id}
checked={Publish[record?.id]?.["ispublish"] ...
-2
votes
3
answers
124
views
Javascript .map() an object of arrays
I'm trying to .map() an object of arrays to create a div for each key/value pair. Here is a sample of the object format:
const data = {
year: ["2018", "2020"],
make: ["...
1
vote
1
answer
127
views
TypeError: Cannot read properties of null (reading 'useContext') - Material UI
I'm using MUI(Material UI) in my project.
Component that I'm trying to use is Button.
Check its official component docs here.
Code in which error is occuring :
import * as React from 'react';
import ...
0
votes
2
answers
48
views
React Component Collapsing Issue: Ref Not Initialized During URL Parsing
I have a component that should expand if it is selected. Here's my current approach:
<Element
ref={elementRef}
style={{ height: isSelected ? `${elementRef.current.scrollHeight}px` : '0px' }} ...
-1
votes
1
answer
34
views
Runtime Error with react-data-table-component in React Application
I encountered a runtime error while trying to integrate react-data-table-component into my React application. The error seems to occur when I attempt to render the data table after fetching data from ...
1
vote
1
answer
54
views
In React, does creating a click handler outside the JSX have any improvement on performance?
Here is an example of 2 buttons with click handlers, one function is created in the component body, the other in the JSX. Is there any performance differences?
function Parent() {
const [count, ...
1
vote
1
answer
73
views
Call custom hook only on the active component in the DOM
My goal is to detect a click outside of the components using this custom hook:
const useOutsideClick = (callback) => {
const reference = useRef();
useEffect(() => {
const handleClick = (...
1
vote
3
answers
62
views
Optimistic rendering to show votes
At the moment the votes {count} is not showing up on mount. I'm using useEffect to get the article and useState to set the count to article.votes. The votes go up after clicking the button twice as ...
0
votes
1
answer
45
views
How do I avoid whitespace collapsing in Motion Canvas Text?
I am recently using Motion Canvas for my animations. I want to avoid whitespace collapsing in Txt component. I have looked for solution like change the style of whitespace to pre but this is not even ...
-3
votes
3
answers
73
views
What is the simplest possible way to get a div button to hide its parent div on click in React.js [closed]
I have a task that is simple (one line) in plain HTML/CSS/JS, but I can't find a simple and working method in React.
I have a parent div, and it has two children. The second child is the meaningful ...
0
votes
0
answers
12
views
Error in a script for Adobe Illustrator in charge of numbering
I’m working on a JavaScript script for Adobe Illustrator that will number multiple text fields in an.ai. The script should increment the numbering in multiple text fields at the same time and generate ...
0
votes
0
answers
27
views
Can not get label color from Premiere pro using extend script
I want to use Extend script to get the color of the labels of the clips in a Premiere pro sequence.
However, I keep getting “undefined”.
The clips in the sequence are labeled with various colors as ...
-4
votes
1
answer
88
views
React app still stuck on loading page despite having an active session on my local Keycloak server [closed]
I am developing a react app locally and using Keycloak to manage authentication. I used the keycloak.js package and the react-keycloak package to access the Keycloak server from the react app.
When ...
1
vote
1
answer
52
views
Why component state is empty after dispatch redux action?
I am trying to implement the product list & search feature with debounce, but SearchProducts component's state search is empty after the dispatch action in the ProductList component. Can someone ...
1
vote
1
answer
66
views
Data-driven fields in React form [duplicate]
I'm building a form in React to support user input for CRUD operations. I'm looking to make the fields shown in the form data-driven from an array with a view to eventually be able to read them from a ...
-1
votes
1
answer
25
views
Why is my dynamically generated HTML content not appearing in the React component? [duplicate]
I'm building a React application where I need to insert some HTML content dynamically based on user interactions. Here's a simplified version of what I'm trying to do:
import React, { useState } from '...
0
votes
1
answer
49
views
React state showing weird behavior
I am new to react and making a simple shopping cart for a coffee shop. whenever i add a item to cart if the item is not already in cart then i basically add it in with the rest of the items and set ...
0
votes
1
answer
59
views
Prop is not giving effect
This is my react component
const ButtonComponent = ({ children, onClick, disabled, className = "" }) => {
console.log("class name is ", className);
const buttonClassName = ...
0
votes
0
answers
20
views
React useEffect() not executing before page render [duplicate]
I'm trying to pull postcode information and display it on my react app. The code so far looks as such:
const UKPar = () => {
postcode = "SW1A2AA"
const [ukPostcodeData, ...
0
votes
1
answer
36
views
How can I pass the value between tag to the child component? react jsx
I have jsx like this,
import TableCell from '@mui/material/TableCell';
import TableCell from '@mui/material/TableRow';
<TableRow>
<TableCell sx={{minWidth:45,width:45,maxWidth:45,...
1
vote
2
answers
68
views
How to change the Page in React.js
I'm learning React.js and I'm creating a demo.
I have created a Login page. Now I want to develop the functionality that if I'm using admin's credentials then I should change the current page layout ...
1
vote
1
answer
72
views
React's useState hook defined inside function component in TypeScript still gave error - Invalid hook call
I was building a custom react component library. When I started using useState hook for a hover feature implementation. I started getting the following error in the browser console from the app ...
1
vote
1
answer
59
views
How to pass modular styles through props in React?
I have a component:
import React from 'react';
import s from './SectionsTitle.module.css';
const SectionsTitle = (props) => {
return (
<div className={props.styleTitle}>
{props....
1
vote
2
answers
77
views
Ensure that Promise has been resolved before rendering view
What specific syntax needs to be changed in the code below in order for the value returned by the currentSession() function to correctly set the html that is rendered to the user in the web browser?
...
-1
votes
1
answer
67
views
Typescript error showing in npm run build
I am new in next js. My problem is that when i am running npm run build, it is showing typescript error even though i am not using it in my project. I am implementation for internationalization and it ...
0
votes
0
answers
24
views
Lightningchart JS - Chart is not interactable
I have 5 different line charts being rendered in my React app. Below is one of the methods to create those charts.
function createEcgHeartRateChart(
response: any,
startInterval: string,
...
0
votes
0
answers
29
views
Change site name [duplicate]
I can’t change the site name, I tried adding a tag
<meta property="og:site_name" content="sitename">
tried schema.org
<head>
<script type="...
0
votes
1
answer
277
views
NextJS App Router: How to access child component properties in layout?
To make use of the layout feature in the NextJS's App Router, I want to dynamically update the page title (<h1> tag, not metadata like <title>) on the layout depends on what the page ...
1
vote
1
answer
42
views
Is there a way to redirect to different links depending on the user's status?
import React from "react";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import Link from "next/link";
import { ...
0
votes
1
answer
31
views
React app 'Encountered two children with the same key, `thumb-undefined`'
I'm trying to create a time slider in my react app and I can't beat this error below that keeps showing up in my browser console.
bundle.js:21658 Warning: Encountered two children with the same key, `...
0
votes
1
answer
80
views
Showing intersection of a plane in a 3d shape with Three.js
I tried to animate with Three.js to show the intersection plane on a 3d object. In this example, I have used a cone as an example for the 3d object in the following code:
import React, { useRef, ...
0
votes
4
answers
103
views
How to make text follow progress bar
How can I make my currentProgresstext follow the progress bar, for now it seems that setting progressWidth to 100 makes the text appear on the left (following the progress bar). And the progress bar's ...
0
votes
1
answer
46
views
Using an external function to fetch data in NextJS
I'm trying to limit repeated code by moving the code that fetches data to an external file.
The fetchUserInfo I'm using uses the useEffect, useState hooks and as such needs to be a "use client&...
0
votes
0
answers
26
views
Alter Javascript hash inline
My script is like this, TableCell has the one element sx which works like a stylesheet
Material-UI
https://mui.com/material-ui/api/table-cell/
var sx = {padding:"10px 0px 10px 0px",fontSize:&...
0
votes
1
answer
37
views
React - component content not pulling through
I'll admit I'm relatively new to React but I'm simply trying to pull through content from a Child component to the parent App component but it's not pulling in the content and I can't figure out why.
...