Pawan Kumar

Results 129 issues of Pawan Kumar

App.tsx ```tsx App.tsx import React, { useState, useRef } from "react"; import { Stepper, StepperRef } from "./Stepper"; const App = () => { const steps = ["Login", "Shipping", "Payment",...

answer
434

## Info ```yaml difficulty: medium title: clearAllTimeout type: question template: javascript tags: javascript, timers ``` ## Question In JavaScript, `clearTimeout` is used to cancel a **single** timeout. Your task is...

new-challenge

useReducer.js ```js useReducer.js import { useState } from "react"; export function useReducer(reducer, initialState) { const [state, setState] = useState(initialState); const dispatch = (action) => { setState(() => reducer(state, action)); };...

answer
react
385

App.jsx ```jsx App.jsx import { useState, useEffect } from "react"; const PAGE_SIZE = 5; export default function App() { const [page, setPage] = useState(1); const [storyIDs, setStoryIDs] = useState([]); const...

answer
react
380

App.jsx ```jsx App.jsx import { useEffect, useState } from 'react'; const Input = ({ onChange, label, placeholder, id }) => { useEffect(() => { console.log(`Input mounted`); }, []); return (...

answer
react
366

App.jsx ```jsx App.jsx import { useState } from 'react'; const ComponentWithState = () => { const [isActive, setIsActive] = useState(false); return ( setIsActive(!isActive)}>click to highlight ); }; export default function...

answer
react
364

App.jsx ```jsx App.jsx import { useState } from "react"; export default function App() { const [isCompany, setIsCompany] = useState(false); return ( e.target.checked ? setIsCompany(true) : setIsCompany(false) } /> Is Comapny?...

answer
react
360

App.jsx ```jsx App.jsx import { useState } from "react"; export default function App() { const [isCompany, setIsCompany] = useState(false); return ( e.target.checked ? setIsCompany(true) : setIsCompany(false) } /> Is Comapny?...

answer
react
360

Is there a way to use fakeTimers in sandpack's tests component? Currently I am forced to use realTimers. It works but it takes a long time to see the tests...

triage