I’m getting the following when I try to do an npx create-next-app: I’m trying to work through some training that doesn’t use TypeScript, but it won’t let me select No for an answer. I don’t understand why it asks the question. Another PC of mine doesn’t ask me about TypeScript, so it must be a configuration issue. Answer create-next-app behaves
Tag: reactjs
Is it valid to use the “return” keyword in a useEffect to stop code execution?
I was debating with a collegue today about using the “return” key in a useEffect to stop code execution. I have learned that using return should only be done in a cleanup. The issue: The way I see this is that we should perhaps have yet another useEffect that only execute if the state is false and not use the
No component being rendered on router.push(‘/page’) unless reloaded
On successful login, I’m embedding the user token in browser cookies and using router.push(‘/dashboard’) to take the user to his dashboard, but the ‘/dashboard’ page is not rendering any components unless I trigger a reload, on which all the components are rendered on the screen. Code block from /login page: Code block from /dashboard page: which on first returns a
Cannot push to DynamoDB without the inclusion of a certain value
I want to push some data from a form to DynamoDB for storage. If I include data for nutrients, this all works swimmingly. When I exclude nutrients, for some reason the push fails. I want this to work with any of these values missing except recipe_index and item_type (recipe_index is auto-generated from a query at the top of the script;
ReferenceError: FileReader is not defined in Next.js
I am trying out the new functions of Next.js 13 with the /app folder, but in a simple client-side component that handles an input form, I am trying to use FileReader but receive an error when browsing. This is the summary of the code: Error: What am I doing wrong? Answer Like accessing window, any browser-specific code in Next.js needs
Updating state using api in useLayoutEffect does not work before painting component
The getUser method exists for API calls. I am trying to display the user profile when the user refreshes the website. That’s why I used useLayoutEffect because I wanted to update the globalUser state before painting and then show it when the web page is painted. But the globalUser state value is null when I refresh the page, then quickly
why can’t access the function inside the listener
I am using a class component. When I run this script, it plots the graphic, but in the next line when it calls the function computePM_from_ClickedPoint, I get the error below. The error refers to “this”, but without it, I cannot call the function. Suggestions? Error: Cannot read properties of undefined (reading ‘computePM_from_ClickedPoint’) tried unsuccessfully changing the call to: Answer
How can I position my autocomplete box under the search box?
Hello I’m trying to create a custom suggestion box for search box. The parent div is flex box and suggestion box is positioned absolute. but the top and left property of css. It is taking of global page and not parent. You can see in css “suggesetionbox” the top property is targeting complete page not parent div. Can someone suggest
How can I set a default value from useSelector (React-Redux) if the state is compiling too slowly?
I’m making an educational program with React-Redux and I’m trying to make a form with items that appear and are removed sequentially. So users enter an initial observation for a reaction, click submit, the initial observation box disappears and a new button is enabled which means the user can click on a test tube and see a colour change, etc.
Unpredictable state change
I am dynamically creating mathlive fields and adding them to the DOM. Though it isn’t a good way but doing it like this because I wasn’t able to add the element as a React component and I needed a workaround quickly Now when I remove an element from array responsible for rendering the elements, it works as expected but when