Skip to content

Tag: reactjs

Fetching JSON and rendering it with react

My fetch gives me the following JSON: “{“name”:”John”,”age”:26,”city”:”London”}” However when i try to render it on my page like this: I get a TypeError: Cannot read property ‘map’ of undefined How can i fix this? Thanks in ad…

use getStaticProps in component

I started a project with next js and typescript. I have a main component that I call it in the index.js page I use the getStaticProps function in the main component getStaticProps returns a prop object and when I log this prop in my main component I received undefined in my console. I want to know using the g…

How to pause for loop and then continue looping

Currently, I am trying to build a function that does the following thing: First click: 1, 2, 3, 4, 5, 6, 7 Second click: 8 Third click: 9 But in the snippet the code does this now: First click 1, 2, 3, 4, 5, 6, 7 Second click 1, 2, 3, 4, 5, 6, 7, 8 Third click 1, 2,