> For the complete documentation index, see [llms.txt](https://reactjs.koida.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reactjs.koida.tech/react-in-the-beginning/lesson-1-demo-build-a-simple-react-app-fast.md).

# Lesson 1 - Demo: Build a Simple React App - Fast

### Sign in to CodeSandbox

{% embed url="<https://codesandbox.io>" %}

Demo on codesandbox.io cloud web

API endpoint: <https://dog.ceo/api/breeds/image/random>

<figure><img src="/files/TA1DclKsN83V1mxk2s1m" alt=""><figcaption></figcaption></figure>

Step 1.  Sign in to CodeSandbox&#x20;

Step 2. In Dashboard,  click <mark style="color:red;">**+Create**</mark> button

* Chose React(TS) template
* Configure your project and use default setting&#x20;
* Click "Create Sandbox" button

Step 3. You are now in React Project editor  mode. You can find all files for React in left panel.:

```jsx
// App.jsx

import { useState } from "react";
import "./styles.css";

export default function App() {
  const [image, setImage] = useState("");
  async function getRandomDog() {
    const data = await fetch("https://dog.ceo/api/breeds/image/random");
    const res = await data.json();
    console.log("Result : ", res.message);
    setImage(res.message);
  }
  return (
    <div className="App">
      <h1>Hello Puppy</h1>
      <h3> Fetch puppy from remote site(API)! </h3>
      <button onClick={getRandomDog}> Get me a puppy </button>
      <div>
        <img src={image} alt="" />
      </div>
    </div>
  );
}
```

```jsx
// index.jsx

import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";

const rootElement = document.getElementById("root")!;
const root = ReactDOM.createRoot(rootElement);

root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);
```

```css
// styles.css
.App {
  font-family: sans-serif;
  text-align: center;
}
button {
  background-color: bisque;
  color: brown;
  margin-bottom: 3px;
}
img {
  width: 70%;
}
```


---

# 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 dynamically by asking a question.

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

```
GET https://reactjs.koida.tech/react-in-the-beginning/lesson-1-demo-build-a-simple-react-app-fast.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
