Qs: React + JavaScript [Live Coding]


Must Knows


What's Live Coding in React ?

It's a technical interviewing style. Your interviewer(s) watches while you code. In React.

Small projects for you to try to solve. Typically in 30 to 60min.

It then drifts into another type of interview:

  • Code Review (reasonable chance)

  • Code Quality (reasonable chance)

  • System Design (small chance)

  • LeetCode (tiny chance)


Categories of Live Coding in React

API Integration - Fetch and Display Data with 2 API Calls

  • basic implementation

  • with Pagination

  • Mobile-First Responsive w Flexbox

  • Mobile-First Responsive w Grid

  • with Axios

  • with React Query

  • Todo List

  • Search & Filter a List

  • Form with Validation

  • Memoization i.e. optimize existing code

  • Theme Switcher

  • Debounced Search


Skills Tested in Live Coding in React

typing

basic component structure, list rendering, event handling, hooks.

useState, performance-conscious updates, derived state.

useEffect, efficient rendering.

setTimeout/clearTimeout.

controlled components, controlled inputs, and React reactivity.

async/await, API error handling, HTTP status check.

validation logic, dynamic error display.

Component composition, props, conditional rendering.

Global state (Context API or props)

CSS: CSS-in-JS or Tailwind logic, conditional classNames.

React Router basics, component routing, URL awareness.

custom hook (e.g., useLocalStorage or useDebounce)

React.memo or useMemo


Challenges


Ask GPT

Prompt "Pls give me 3 mini exercises (without showing solution) for live coding in react and typescript"

This will give some good challenges.


The Oh-So-Famous Counter App

Update the code below to get the expected behavior:

  • counter starts from 0.

  • click the '+' button to increment.

  • click the '-' button to decrement.

SOLUTION


Create a useIsFirstRender() hook

Complete the code below by creating a hook to tell if it is the first render.

SOLUTION

You can do it with useState() instead of useEffect() but

  • useRef does not trigger a re-render when you update it (isFirst.current = false) -> more efficient

  • useState does trigger a re-render when you call setIsFirst(false).


Create a usePrevious() hook

Complete the code below by creating a custom hook to return the previous value of a state.

SOLUTION


Create a useToggle() hook

It is quite common to see switches and checkboxes in web apps such as:

Update the code to implement useToggle() custom hook instead to make things easier such as:

const [on, toggle] = useToggle()

SOLUTION


Create a useDebounce() hook

For a frequently changing value like text input you might want to debounce the changes.

Implement useDebounce() to achieve this such as:

  • input value and a delay (in milliseconds).

  • Returns a debounced value that only updates after the delay has passed without further changes.

Complete the code below by implementing useDebounce() custom hook.


Random Chuck Norris Images

Being given these 2 APIs

  • https://api.chucknorris.io/ - The Internet Chuck Norris Database

  • https://developers.giphy.com/docs/ - Giphy API

Select one random Chuck Norris joke and look for a matching gif by using the first 3 words from the joke. The result should be displayed with the image on the left side and the text on the right side, positioned in the vertically in the middle.

Whenever the image is clicked, a new gif will be loaded.

Caveat: the Giphy API will return the same set of images for a given string, so in order to produce an observable change, the application needs to request more images on the first load and cache them internally.

const GIPHY_API_KEY = "2cZkiFTqyiS79UdSapL6LHWlublpl7iy"; const DEFAULT_GIF = "https://media.giphy.com/media/l3q2K5jinAlChoCLS/giphy.gif";

SOLUTION:


Giphy App

End Result: should look like https://ghyphir.pages.dev/arrow-up-right

App Requirements:

• Show trending gifs (Giphy API) when no search text is applied • Search gifs by text (Giphy API) • Handle loading and error • View more button • Persist last search in browser • Copy gif URL on click

Technical Requirements:

• You must use React. • You may use any JavaScript/CSS libraries (e.g., Tailwind, Axios, etc.). • You are allowed to use resources like Google, Stack Overflow, etc • AI tools such as search engines or autocompleters are allowed, but not generative AI; we want to assess your knowledge first. • UI design will not be evaluated, but clean code structure and thoughtful logic will be.

Submission:

• A GitHub repo with your code. • A README that includes setup instructions. • (Optional) A live deployment (e.g., Vercel, Netlify).

Notes:

• You’ll need to sign up for a free Giphy Developer account to get an API key. • This challenge is designed to evaluate your practical skills — don’t worry about visual polish. • Creativity and clarity are more important than perfection.

SOLUTION

TODO


API Call and Displays List Of Users

Build a small React application that displays a list of users fetched from a public API.

Example API: https://jsonplaceholder.typicode.com/users

Functional requirements: 1️⃣ Fetch data from a public API (e.g., https://jsonplaceholder.typicode.com/users) 2️⃣ Display a list of users showing their name and email 3️⃣ When clicking on a user, show detailed information (phone, company, address) → This can be displayed in a side panel, modal, or separate section 4️⃣ Include a real-time search input that filters users by name or email 5️⃣ Show a loading state (loader/spinner) while fetching data 6️⃣ Handle API errors and display a visible error message to the user 7️⃣ Implement a simple cache mechanism to avoid unnecessary API calls → Example: store fetched users in memory or localStorage 8️⃣ Support pagination or lazy loading for large user lists 9️⃣ Add unit tests for 1–2 key components (e.g., UserList, UserDetails)

SOLUTION

TODO


API Call + List View w Sorting and Dynamic Filtering + Detail View

you have the API, based on the Ricky & Morty API, to perform the challenge.

  • https://rickandmortyapi.com/

  • i.e. endpoint https://rickandmortyapi.com/api/character

Two main screens in the app: 1/ Listing View • show a list of items coming from the API, with some information. Title and image are mandatory. • The app will be able to order the items by (at least) the Title. • The app will be able to filter the items by some of the fields. It could be a property from the items with any select or checkbox or a search field, or all of them.

2/ Details View • It will show detailed information about the selected element.

SOLUTION

TODO


API Call + List View + Favorites

The are many Rick and Morty fans out there looking for a web application that will help them look for any character and mark them as favorite.

Rules:

  • Use Typescript (The right way, "any" is not the right way!).

  • Create all components from scratch, components libraries are forbidden.

  • Implement good semantic HTML (div is not always the solution).

  • Use best practices.

  • If you know any React pattern, feel free to use it!

  • Adding styles is important! No need to be picasso, make it feel like a real application.

Requirements:

  • When a user types into the search field, an autocomplete dropdown should appear, displaying a list of matching characters.

  • Use the Rick and Morty API https://rickandmortyapi.com/

  • The search should be perform after typing the first 2 letters of the characters.

  • Each item in the autocomplete list must show the character's name and image.

  • Each character in the autocomplete results should have a "favorite" icon (e.g., a star ⭐). Clicking this icon adds the character to your favorites list and immediately removes them from the autocomplete results.

  • Characters that are currently in the favorites list should not appear in the autocomplete search results.

SOLUTION

TODO


TODO

  1. Simple Form https://frontendeval.com/questions/mortgage-calculator

  2. Complex Form https://frontendeval.com/questions/multi-step-form

  3. Pagination and data fetching https://frontendeval.com/questions/job-board

More React Live Coding Questions:

  • https://bigfrontend.dev/

  • https://www.hackerrank.com/domains/react

  • Mock JSON data https://jsonplaceholder.typicode.com/

Last updated