Access to all courses
Hooks & Events
Continuing to work on CardDisplay.tsx now, let's add some states and get the pagination working! Import useState and useEffect at the top. And inside the CardDisplay function let's create some states: ts const [page, setPage] = useState(0); const [slicedUsers, setSlicedUsers] = useState ([]); The first state, page , is just like a state we'd create with regular Javascript. The second one, slicedUsers is a little different and leverages Typescript's 'generics'. In typescript- you can create functions and interfaces that are 'generic'. That means they accept and utilize different types.
The rest of this lesson is waiting.
Join JS Mastery Pro to unlock it.





Get Full Access
$120 /month
Lock in a year & save—2 months free!
Quizzes, mini-challenges, AI summaries, inline sandboxes
Participation in a private community
Build real production-grade apps
Mock interviews & project reviews
Weekly live sessions & member-only access