475,605 questions
-1
votes
0
answers
65
views
How do I use useRef as input in a function with TypeScript?
I am trying to make an automatic scroll preference in production environments. For the scrolling utility for my React website I have chosen TypeScript due to what I have heard about its ability to ...
Best practices
0
votes
0
replies
42
views
What is the best strategy for managing permissions and role-based access control (RBAC) in a large React application?
I am working on a large React application that supports multiple user roles such as Admin, Manager, Editor, and Viewer. Each role has access to different pages, components, actions, and API operations....
Best practices
0
votes
2
replies
109
views
Confused about React TypeScript function and function component declarations
I'm wondering why some ways of declarations are valid while others are not and are throwing errors as shown below:
Correct
export const useDebounce = <T,>(val: T): T => {
const [...
Best practices
0
votes
1
replies
53
views
(Partial) React hydration of dynamically created documents
I'm developing an extended dialect of Markdown. I want to make certain elements interactive and am aiming for a SSR/hydration approach using vanilla React. However most of the document is "dumb&...
-2
votes
0
answers
37
views
window.addEventListener() keeps triggering multiple times in reactjs [duplicate]
I'm building a music player in ReactJS, and for that, I wanted the audio player to be toggled between playing and paused when the space key is pressed.
So, for that, I added an event listener code ...
Advice
0
votes
1
replies
89
views
Advice needed on a React application with Laravel backend
I'm currently working on a personal project related to Warhammer. Because I needed to test some things, I have made an test project for a quiz that would help select a faction. But I'm kind of still ...
-4
votes
1
answer
99
views
Convert React script running using a CDN to use server installed React [closed]
This code
<script crossorigin="" src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin="" src="https://unpkg.com/...
-1
votes
1
answer
86
views
Next.js API route getting called multiple times in development mode [duplicate]
I am working on a Next.js application with App Router and noticed that my API route is getting called twice during development.
I have a simple fetch inside useEffect:
useEffect(() => {
...
Best practices
0
votes
1
replies
97
views
How to create a facebook like newsfeed?
I am working on a social media platform and have a feeds page, when user scroll down the feeds page we have to show the author, newsletter recommendations, currently I have hard coded this showing ...
4
votes
2
answers
439
views
Are the @eslint-react/no-unstable-default-props and @eslint-react/no-unstable-context-value rules still relevant in React 19?
I noticed that the ESLint React rules no-unstable-default-props and no-unstable-context-value are disabled by default. They seem to be useful rules regarding avoiding unnecessary re-renders through ...
Tooling
3
votes
8
replies
143
views
Redux Toolkit vs Zustand: which is better for global state management in a Next.js e-commerce app?
I am building an e-commerce application with Next.js and I need to manage global state for features like cart, user authentication, and product listings.
I have experience with both Redux Toolkit and ...
4
votes
1
answer
102
views
Inline ref cleanup throws TypeError: Cannot read properties of null during concurrent transition rollbacks
I recently upgraded our application to React 19 and started refactoring our legacy useEffect DOM cleanups to use the new Ref Cleanup Function feature (where callback refs can return a cleanup function)...
-2
votes
0
answers
60
views
Trying to build UI using react tailwind not able to figure out how to get he desired output [duplicate]
I'm trying to build a UI where a large heading partially reveals an image inside the text while the remaining part of the image stays visible normally below the text.
Layout idea:
Top section ...
Best practices
0
votes
1
replies
128
views
Alert when the user leaves the Text Editor
i need to alert to the user when he´s going to leave the URL where i have an Text Editor.
I´m working with React + JS. I declare an state that´s change to true when the user starts typing on the Text ...
Best practices
1
vote
11
replies
214
views
What is the best practices for react object update for a react js
I want to know about what are the best practices for React hook useState object update so not lose data and give always latest state even I use nested methods and update continuously.
When I update my ...
