I cant quite figure out how I am supposed to pass an object as a prop when using useState in Next JS. I have a lorem ipsum generator that I created in javascript functions. I have a component called Paragraphs that houses it. I need to pass in two properties, a number of paragraphs. a sentence length. The paragraph length
Tag: reactjs
React index.js in Django Project doesn’t render imported components
I am trying to build a project with a hybrid architecture with Django as Backend and React as Frontend. For this I use Webpack and Babel to pipe the js files into djangos static index-bundle.js. However I encountered a problem which I don’t understand. Apparently I can not import other components into my index.js react file. Instead, the root div
Typescript dynamically infer type from object
I have a JS Object with React components, indexed by ID. I would like to have a ModalEntity type which results in this: My problem is, I want the type to be dynamically generated from the MODAL_ENTITIES object, since I want the process of adding a modal to be as effortlessly as possible. Is there a way to define this
React – Can console log object, but not specific property of said object
I’m doing an exercise to learn React in which I have set up a page with a list of clickable pokemon names which are linking to the pokemons specific detail page. Below is the code of the details page This code has an error I fail to understand The console.log(specificPokemon) works fine, but the console.log(specificPokemon.name) gives me the following error
formData in React, getting null when I send formdata to backend Express
When I send data from the frontend I receive null in the backend. I am sending 2 string data URLs and dates so I don’t think that I need to use extra middleware for receiving the values. Frontend: Backend: Answer it’s empty because on the server you have a json parser, but you’re sending a multipart/form-data request, and there is
React and JS closure issue
Background of the problem I have a simple “Ticker” class that can hold a single callback, and execute that callback each ~1s via setInterval The code is as follows. I have a React Functional Component in a nother file, that instantiates a Ticker Object, at class level(I.E outside the functional component) but inside the same file. Here’s the code for
date copy stops the loop statement to function as intended
What i am trying to do is to display available rooms which are in data i map the rooms using data.map , check if one is available between a given ( checkin and checkout date ) using availdata[p.roomId][date].i==0 , if not it will display the available room . the code works fine but as soon as it finds an available
My input didn’t update value when I update state
I made two components, one is sign in component and one is form input. I pass props to form input to render some input form. And I also had a state to save the value of this inputs (two way binding). Rendering is fine till now. The problem when I submit form and set state to initial, i saw the
‘Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘writeFile’)’ error while trying to write to a file with REACT
I am trying to write to a file with a button click inside my React application and it gives an error. My current code looks like this. Once I click the SYNC button it gives this error. This might be a noob mistake since I am new to this. I’d really appreciate if someone could help. Answer Your import statement
Best method to keep track of a users progression through reading sections of text
Similar to zyBooks if you are familiar with it, I want to track the sections the user has read through and checked completed with a button. However, conceptually I am having trouble thinking of what to store in my mongo database, besides just an object or an array of objects that contains each section and bool values, to track their