React example
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.
- Yarn
- Yarn (classic)
- npm
- pnpm
- Bun
yarn workspace <project> add react
yarn workspace <project> add react
npm install --workspace <project> react
pnpm add --filter <project> react
bun install react
- Configure Babel with the
@babel/preset-react
preset. - Configure TypeScript compiler options with
"jsx": "react-jsx"
.