Skip to content
Advertisement

Tag: reactjs

How to Set port in next.js

one application is running on port 3000 and I want to run another application on a different port of the default port. How I change this in React Next.js. My package.js script is and start script command is npm run dev Answer This work for me

What exactly is used for in React Router?

I am new to React learning , and was trying to build an app using react-router-dom. I was able to implement basic routing when I came across the term ‘switch’. Can anyone please explain me with a use-case example where we use switch and what is its use? Answer Since you are new am going to take a bit more

How to update “prevState” in react.js? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. Improve this question I have got a list of array of objects. I want to update the state. When I click on the 1st item of the array,

React: How to mock Auth0 for testing with Jest

I’m using React(react-create-app and TypeScript). Login is made with Auth0. I want to write tests with Jest, and I found this ressource which is basically the only thing around that speaks about Mocking the Auth0 object. So my code looks like this: But I end stuck with this error: Property ‘mockReturnValue’ does not exist on type ‘() => IAuth0Context |

TypeScript React.FC confusion

I am learning TypeScript and some bits are confusing to me. One bit is below: For both functional components above, I see TypeScript generates the same JS code. The PrintName2 component seems more streamlined to me as far as readability. I wonder what’s the difference between the two definitions and if anyone is using second type of React component? Answer

Get tests running time with Jest

Is there any way to know how long my tests take without doing it programmatically with Jest? To be clear, I know that if I add a variable to get the current time before each test and then log this when my test completes I’ll get this information, but I want this automatically, maybe with some Jest configuration. Answer You

Advertisement