---
title: React example
sidebar_label: React
---

import AddDepsTabs from '@site/src/components/AddDepsTabs';

React is an application or library concern, and not a build system one, since the bundling of React
is abstracted away through another tool like webpack. Because of this, moon has no guidelines around
utilizing React directly. You can use React however you wish!

However, with that being said, we do suggest the following:

- Add `react` and related dependencies to each project, not the root. This includes `@types/react`
  as well. This will ensure accurate [hashing](../../concepts/cache#hashing).

<AddDepsTabs dep="react" package="<project>" />

- Configure Babel with the `@babel/preset-react` preset.
- Configure [TypeScript](./typescript) compiler options with `"jsx": "react-jsx"`.
