React Live Coding in Interviews
Lessons from a live coding session during an interview with Jalasoft (52 minutes). The exercise was to implement a pagination component in React: 42 users, pageSize 5, page number navigation, active page highlight, previous/next buttons disabled at the boundaries. Related: entrevista-metodo-star · entrevista-pitch-historias
What Is Evaluated in Live Coding
Beyond reaching a working solution, interviewers observe:
- How you read the prompt â do you understand all requirements before coding?
- How you communicate â do you narrate your reasoning while writing?
- Component structure â do you decompose cleanly?
- Hook usage â useState, useMemo, useCallback in the right places?
- Clean code â variable naming, logic extraction, readability.
- Edge case handling â first page, last page, invalid page.
Common Rules
| What is allowed | What is NOT allowed |
|---|---|
| Googling documentation | Asking AI to generate the code |
| Consulting MDN, React Docs | Using external state libraries (Redux, Zustand) |
| Thinking out loud | Staying silent without communicating |
â ïž They ask you not to use AI to generate the code. That doesnât prevent you from knowing how AI would generate it â but the execution must be yours.
How to Structure the Solution
For the pagination exercise, the natural structure is:
<PaginationExercise />
âââ <UserList users={currentPageUsers} /> // renders the list/table
âââ <Pagination // controls navigation
totalPages={totalPages}
currentPage={currentPage}
onPageChange={setCurrentPage}
/>
Required state:
currentPage(the current page number)- The user list can come as a prop or local mock
Derived logic (no state needed):
totalPages = Math.ceil(users.length / pageSize)currentPageUsers = users.slice(startIndex, endIndex)isPrevDisabled = currentPage === 1isNextDisabled = currentPage === totalPages
Behavioral Tips During the Session
- Read the full prompt before coding. Identify all requirements (highlight, disabled buttons, number navigation).
- Declare the structure before implementing. Write empty components and the required states before filling in the logic.
- Talk while you write. âIâm going to create a state for the current page, and derive the page users with sliceâŠâ
- Ask if in doubt. âShould the listing be a table or a list? Is either fine?â
- Donât panic at errors. Read the console error, reason out loud, fix it.
Common Pitfalls
- Off-by-one:
startIndex = (currentPage - 1) * pageSize, notcurrentPage * pageSize. - Wrong totalPages:
Math.ceilensures the last partial page is counted. - Inefficient render: use
useMemoto derivecurrentPageUsersif the list is large â but in a simple exercise, donât over-engineer. - Forgot the highlight: the active page must have a distinct style. Double-check the prompt.
On Testing in Live Coding
If asked about testing:
- Cypress for E2E and integration tests â used in production environments where the full 20-minute test suite covered the entire system.
- Playwright for projects where Cypress is insufficient or where more advanced use cases apply.
- In live coding, they rarely ask you to write tests â but they may ask how you would test the component.
Related: entrevista-metodo-star · entrevista-pitch-historias · entrevista-qa