@@ -10,26 +10,28 @@ component body you can yield services, run Effects, subscribe to Effect-powered
|
||||
state, and still export a normal React function component at the edge of your
|
||||
app.
|
||||
|
||||
This guide starts with the smallest useful setup:
|
||||
|
||||
1. Install `effect-fc` with its peer dependencies.
|
||||
2. Create a React runtime from an Effect `Layer`.
|
||||
3. Wrap your React app with `ReactRuntime.Provider`.
|
||||
4. Write a component with `Component.make`.
|
||||
5. Convert it to a React component with `Component.withRuntime`.
|
||||
|
||||
## Install
|
||||
|
||||
Install `effect-fc` alongside `effect` and React 19.2 or newer:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install effect-fc effect react react-dom
|
||||
npm install effect-fc effect react
|
||||
```
|
||||
```bash npm2yarn
|
||||
npm install --save-dev @types/react
|
||||
```
|
||||
|
||||
If your project uses TypeScript, also install React's type packages:
|
||||
`effect-fc` is not opinionated about the React platform. Use it with web,
|
||||
native, custom renderers, or any environment where React components can run.
|
||||
Then install the platform-specific React packages for your target.
|
||||
|
||||
For web apps, install React DOM:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save-dev @types/react @types/react-dom
|
||||
npm install react-dom
|
||||
```
|
||||
```bash npm2yarn
|
||||
npm install --save-dev @types/react-dom
|
||||
```
|
||||
|
||||
## Create A Runtime
|
||||
|
||||
Reference in New Issue
Block a user