# Week 2

This session is about the concepts of State as used in React components, as well as Conditional Rendering.

## Contents

* [Preparation](/course-content/frontend/react/week2/preparation.md)
* [Session Plan](/course-content/frontend/react/week2/session-plan.md) (for mentors)
* [Assignment](/course-content/frontend/react/week2/assignment.md)

## Session Learning Goals

By the end of this session, you will:

### Props

* [ ] Understand what props are when to use them
* [ ] Be able to pass props to components
* [ ] Know the concept of props as your component's API to make them re-usable
* [ ] Read props using object- and destructuring syntax
* [ ] Be able to forward props to child components
* [ ] Be familiar with child components
* [ ] Deal with rendering child components passed to your components

### State

* [ ] Have a solid understanding of what the difference between Props and State is
* [ ] Understand what State is and know examples of cases when to use it
* [ ] Be familiar to the fact that React uses Hooks
* [ ] Be able to update different kinds of State
* [ ] Have a basic understanding of what causes component re-renders
* [ ] Be able to share State and state update functions with child and parent components

### Conditional Rendering

* [ ] Understand conditional rendering based on Props
* [ ] Conditionally render content based on State


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://program.hackyourfuture.dk/course-content/frontend/react/week2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
