Skip to content
Advertisement

Tag: reactjs

how to pass an object as a prop in nextjs

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

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

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

Advertisement