Create Task Manager app: Setup React application and Integrate Fluent UI

After setting up the Github actions, let’s now move on to the frontend side React application development. We’ll build the frontend incrementally, starting with Fluent UI and understanding how a React application is bootstrapped.

Step 5.1 – React application setup and Fluent UI

Frontend development starts here. Our first objective is simple: replace the default Vite screen with a working Task Manager application shell using Fluent UI.

1. Understand the existing React structure

Open our frontend directory. Our generated structure should look similar to this:

frontend/
├── public/
├── src/
│   ├── assets/
│   ├── App.tsx
│   ├── App.css
│   ├── index.css
│   └── main.tsx
│
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts

Before coding, understand these four files.

FileResponsibility
index.htmlHTML entry point
main.tsxReact application entry point
App.tsxRoot React component
index.cssGlobal styles

How does React start?

index.html – Contains the root DOM element: <div id="root"></div>. It loads main.tsx as a JavaScript module.

main.tsx – This is the React entry point. It initializes React using createRoot() and mounts the root component.

App.tsx – This is our root UI component. Eventually, it will compose authentication pages, task list and task details. This distinction is important: main.tsx initializes the application; App.tsx defines its UI structure.

2. Install Fluent UI React v9

Microsoft’s current Fluent UI React v9 package is @fluentui/react-components. Its current npm release is 9.75.2.

From your frontend directory:

cd frontend

npm install @fluentui/react-components

Official documentation: Fluent UI React v9.

Why do we need FluentProvider?

Fluent UI uses CSS-in-JS styling and a theme system. FluentProvider provides the theme and styling context to its child components. Without the provider, our application won’t have the intended Fluent UI theme setup.

3. Configure FluentProvider in main.tsx

Open: frontend/src/main.tsx

Our task is to:

  1. Import FluentProvider and webLightTheme.
  2. Wrap the root App component with FluentProvider.
  3. Keep React’s StrictMode.
  4. Keep the global CSS import.

The intended component hierarchy:

StrictMode
    |
    v
FluentProvider
    |
    v
App
    |
    v
Child components

Conceptually:

<FluentProvider theme={webLightTheme}>
  <App />
</FluentProvider>

Why put FluentProvider in main.tsx instead of App.tsx?

Because we want the entire application to share the same theme and styling context. Later, if we introduce React Router, every route will automatically have access to Fluent UI. Microsoft recommends placing the provider near the application root.

4. Create our initial application shell

Open: frontend/src/App.tsx For now, replace the default Vite demonstration screen.

Our first component should:

  • Display the heading Task Manager.
  • Display a short description: Manage your tasks efficiently.
  • Show a Fluent UI primary button labelled Add Task.
  • Keep the component as a functional React component.

We can import: import { Button } from "@fluentui/react-components";

A Fluent UI button supports different appearances:

AppearanceTypical usage
primaryMain action
secondarySecondary action
outlineOutlined button
subtleLow-emphasis action
transparentMinimal visual emphasis

For our Add Task button, use: appearance="primary"

Don’t implement the click functionality yet. We’ll do that when we introduce component state.

5. Our eventual React folder structure

We’ll gradually build towards this structure.

src/
├── app/
│   ├── App.tsx
│   └── providers/
│
├── components/
│   ├── layout/
│   └── common/
│
├── features/
│   ├── auth/
│   └── tasks/
│       └── components/
│
├── services/
│   └── api/
│
├── hooks/
│
├── types/
│
├── main.tsx
└── index.css

Why organize using features/? Our application has two main business features:

  • Authentication.
  • Task management.

Keeping feature-related components together makes the application easier to maintain as it grows. We’ll avoid creating empty files and directories until we actually need them.

6. Verify your React application

Start Vite: npm run dev

Open: http://localhost:5173

We should see our Task Manager heading and Fluent UI button.

Now run: npm run lint

Since we selected Oxlint, this should run our configured linting checks.

Finally: npm run build

This verifies the TypeScript compilation and production build.

# package.json
 "dependencies": {
    "@fluentui/react-components": "^9.75.3",
    "react": "^19.3.1",
    "react-dom": "^19.3.1"
  },

# main.tsx
...
import { FluentProvider, webLightTheme } from '@fluentui/react-components'

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <FluentProvider theme={webLightTheme}>
      <App />
    </FluentProvider>
  </StrictMode>,
)

# App.tsx

import { Button } from '@fluentui/react-components';

function App() {

  return (
    <div>
      <h2>Task Manager </h2>
      <p>Manage your tasks efficiently</p>
      <section>
        <Button appearance="primary">Add Task</Button>
      </section>
    </div>
  );
}

export default App;

A couple of small suggestions:

  • Keep FluentProvider in main.tsx, not in individual components.
  • Keep StrictMode. We’ll discuss why React may execute certain development lifecycle operations more than once when we cover useEffect.

Let’s build our actual Task Manager UI.

Step 5.2 – Build the Task Manager layout

We’ll build our actual UI:

Left panel

  • Task list.
  • Search input.
  • Status filters.
  • Add Task button.

Right panel

  • Selected task details.
  • Description.
  • Status.
  • Edit and Delete actions.

We’ll introduce Fluent UI Input, Button, Badge, Card and layout components.

Step 5.2 – Build the two-panel Task Manager layout

We’ll divide the application into three components.

App
│
├── AppHeader
│   ├── Task Manager heading
│   └── Add Task button
│
└── TaskWorkspace
    │
    ├── TaskList
    │   ├── Search input (later)
    │   └── TaskListItem
    │
    └── TaskDetails
        ├── Task title
        ├── Description
        ├── Status
        ├── Edit button
        └── Delete button

For this step, we’ll implement the static layout and display sample tasks. No API calls or React state yet.

1. Create component directories

From your frontend directory:

mkdir -p src/features/tasks/components
mkdir -p src/features/tasks/types
mkdir -p src/components/layout

Create these files:

touch src/features/tasks/types/task.ts

touch src/features/tasks/components/TaskList.tsx
touch src/features/tasks/components/TaskDetails.tsx

touch src/components/layout/AppHeader.tsx

Our structure:

src/
├── components/
│   └── layout/
│       └── AppHeader.tsx
│
├── features/
│   └── tasks/
│       ├── components/
│       │   ├── TaskList.tsx
│       │   └── TaskDetails.tsx
│       └── types/
│           └── task.ts
│
├── App.tsx
├── App.css
└── main.tsx

2. Define our Task TypeScript type

Open: src/features/tasks/types/task.ts

Our Rails Task model currently has:

  • id
  • title
  • description
  • status
  • created_at
  • updated_at

Create a TypeScript type representing this API resource. Our task:

  1. Define a TaskStatus union type containing pending, in_progress and completed.
  2. Define a Task interface containing the fields above.
  3. Use the correct TypeScript types for each property.

Hint:

export type TaskStatus =
  | 'pending'
  | 'in_progress'
  | 'completed';

Why do we need this? – TypeScript helps us catch invalid values during development.

For example: const status: TaskStatus = 'unknown';

TypeScript should report an error because unknown isn’t a supported task status.

Important: Our API uses snake_case (created_at), so we’ll initially use the same property names in TypeScript. We’ll avoid unnecessary response transformations.

3. Build AppHeader

Open: src/components/layout/AppHeader.tsx Our responsibility:

  • Display Task Manager.
  • Display a short description.
  • Add a primary Fluent UI button labelled Add Task.
  • Export the component.

Useful Fluent UI imports:

import {
  Button,
  Text
} from '@fluentui/react-components';

Why create a separate component?

The header is independent of task data. Keeping it separate makes it reusable and easier to maintain.

4. Build TaskList

Open: src/features/tasks/components/TaskList.tsx

This component will receive a list of tasks through props. Its requirements:

  • Accept tasks: Task[].
  • Accept selectedTaskId: number.
  • Display the task title.
  • Display its status using Fluent UI Badge.
  • Visually distinguish the selected task.

Think about how we’ll define component props using TypeScript. The component should eventually look conceptually like this:

interface TaskListProps {
  tasks: Task[];
  selectedTaskId: number;
}

function TaskList({
  tasks,
  selectedTaskId
}: TaskListProps) {
  // Render tasks here
}

Read more about Interfaces: https://www.typescriptlang.org/docs/handbook/2/objects.html
Type vs interface: https://www.typescriptlang.org/cheatsheets/

Use .map() to render the task array. We’ll introduce click handling and callbacks in our next step.