frontend-challenges
frontend-challenges copied to clipboard
FrontendChallenges is a collection of frontend interview questions and answers. It is designed to help you prepare for frontend interviews. It's free and open source.
styles.css ```css styles.css body { font-family: sans-serif; } h1 { font-size: 1.5rem; } span[aria-disabled="true"] { pointer-events: none; opacity: 0.5; } ``` App.tsx ```tsx App.tsx import React, { useState, useRef }...
App.tsx ```tsx App.tsx import React, { useState, useRef } from "react"; import { Stepper, StepperRef } from "./Stepper"; const App = () => { const steps = ["Login", "Shipping", "Payment",...
## 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...
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)); };...
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...
App.jsx ```jsx App.jsx import { useEffect, useState } from 'react'; const Input = ({ onChange, label, placeholder, id }) => { useEffect(() => { console.log(`Input mounted`); }, []); return (...
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...
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?...
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?...