Unverified Commit c2214e7a authored by Jam Balaya's avatar Jam Balaya Committed by GitHub

chore(examples): remove `with-recoil` exmaple (#81836)

## Summary

Remove the deprecated
[with-recoil](https://github.com/vercel/next.js/tree/canary/examples/with-recoil)
example and update the examples manifest accordingly

Chores:
- Delete the examples/with-recoil directory and its contents
- Remove the with-recoil entry from
test/turbopack-dev-examples-manifest.json

## Why?

[Recoil](https://github.com/facebookexperimental/Recoil) was archived by
the owner on Jan 2, 2025.

## Adding or Updating Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

cc: @samcx
Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
parent 345a36c9
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
# Recoil Example
This example shows how to integrate Recoil in Next.js.
[Recoil](https://recoiljs.org) is an experimental set of utilities for state management with React used by some teams at Facebook. This example takes the code from the redux examples and demonstrates how it would be implemented with Recoil.
## Deploy your own
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-recoil&project-name=with-recoil&repository-name=with-recoil)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example with-recoil with-recoil-app
```
```bash
yarn create next-app --example with-recoil with-recoil-app
```
```bash
pnpm create next-app --example with-recoil with-recoil-app
```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
import { useRecoilValue, useSetRecoilState, useResetRecoilState } from "recoil";
import {
countState,
incrementCount,
decrementCount,
} from "../lib/recoil-atoms";
const useCounter = () => ({
count: useRecoilValue(countState),
increment: useSetRecoilState(incrementCount),
decrement: useSetRecoilState(decrementCount),
reset: useResetRecoilState(countState),
});
const Counter = () => {
const { count, increment, decrement, reset } = useCounter();
return (
<div>
<h1>
Count: <span>{count}</span>
</h1>
<button onClick={increment}>+1</button>
<button onClick={decrement}>-1</button>
<button onClick={reset}>Reset</button>
</div>
);
};
export default Counter;
import { atom, selector } from "recoil";
export const countState = atom({
key: "count",
default: 0,
});
export const incrementCount = selector({
key: "incrementCount",
get: ({ get }) => get(countState),
set: ({ set }) => set(countState, (currCount) => currCount + 1),
});
export const decrementCount = selector({
key: "decrementCount",
get: ({ get }) => get(countState),
set: ({ set }) => set(countState, (currCount) => currCount - 1),
});
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"recoil": "0.7.7"
}
}
import { RecoilRoot } from "recoil";
export default function MyApp({ Component, pageProps }) {
return (
<RecoilRoot>
<Component {...pageProps} />
</RecoilRoot>
);
}
import Counter from "../components/counter";
const IndexPage = () => <Counter />;
export default IndexPage;
...@@ -144,7 +144,6 @@ ...@@ -144,7 +144,6 @@
"with-reactstrap": true, "with-reactstrap": true,
"with-realm-web": true, "with-realm-web": true,
"with-rebass": true, "with-rebass": true,
"with-recoil": true,
"with-redis": true, "with-redis": true,
"with-redux": true, "with-redux": true,
"with-reflexjs": true, "with-reflexjs": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment