> For the complete documentation index, see [llms.txt](https://program.hackyourfuture.dk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://program.hackyourfuture.dk/course-content/frontend/react/week2.md).

# Week 2

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

## Contents

* [Preparation](https://program.hackyourfuture.dk/course-content/frontend/react/week2/preparation.md)
* [Session Plan](https://program.hackyourfuture.dk/course-content/frontend/react/week2/session-plan.md) (for mentors)
* [Assignment](https://program.hackyourfuture.dk/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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
