Simple React exercises to practice core concepts from the React Cheatsheet.
📋 View Assignment Instructions - Practice and record yourself completing a kata!
Katas are small, focused coding exercises designed to build muscle memory and reinforce fundamental concepts. Complete these in order to build your React skills!
📡 Intermediate Katas: API Integration - Async/await, fetch API, and list patterns with real data
.map().filter()npm create vite@latest react-katas -- --template react
cd react-katas
npm install
App.jsx to testThese katas reinforce:
Note on Array Methods: While these katas use for loops to practice the underlying patterns, you’ll often see the built-in array methods in real code:
.map() - Transforms each item in an array (List Scrolling Pattern).filter() - Selects items matching criteria (List Filter Pattern).reduce() - Combines all items into a single value (List Patterns)Learn more: MDN: Array Methods
After completing these katas:
Good luck practicing! 🚀
Attribution: These React katas were created with assistance from Claude AI (Anthropic) to provide focused practice exercises for core React concepts.
Kata: A coding exercise where you practice implementing a specific feature or pattern repeatedly to build muscle memory and fluency.
Components: In React, the building blocks of applications. Everything in React is made from components. They help organize code and keep programs from becoming too complicated.
React: A framework created by Facebook in 2013. It’s built on the idea of components and is one of the most popular tools for making modern websites.
JSX: A special syntax used in React. It looks like HTML but isn’t exactly the same. JSX must be used inside React components.
Props (Properties): Attributes you can give to components to make them more powerful. Props are like HTML attributes but for your own custom components.
State: In React, component-local data that React preserves between renders so a component can remember information and update the UI (e.g., a click counter).
useState: Hook that returns a state value and a setter. Initializes component state and triggers re-render when the setter is called.
Hook: Special React function whose name starts with use (e.g., useState, useEffect). Must follow the Rules of Hooks.
handleClick: Conventional camelCase name for a click event handler function.
Function: In programming, reusable blocks of code that perform a specific task. They help organize code, avoid repetition, and make programs easier to understand.
Return: In a React component function, the return statement sends back the JSX that should be shown on the screen.
Conditional Rendering: Showing different UI based on a condition using JS expressions in JSX (e.g., {isOn ? 'On' : 'Off'}).
Ternary Operator: condition ? exprIfTrue : exprIfFalse; commonly used inside JSX for conditional rendering.
Event Listener: In web development, code that waits for something to happen (like a button click or a request) and then runs a function in response.
useEffect: Hook that runs code after a component renders. Commonly used to fetch data when a component first loads.
Async: Keyword that creates asynchronous functions, allowing the use of await inside.
Await: Keyword used inside async functions to wait for a promise to resolve before continuing.
Fetch: JavaScript function that makes HTTP requests to APIs and returns a promise.