├── .changeset
├── README.md
└── config.json
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── config.yml
│ └── feature_request.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── publish-commit.yaml
│ ├── publish.yaml
│ └── pull-request.yaml
├── .gitignore
├── .vscode
└── settings.json
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── SECURITY.MD
├── package.json
├── packages
└── with-react
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ ├── index.test.tsx
│ └── index.tsx
│ ├── tsconfig.json
│ ├── tsdown.config.ts
│ └── vitest.config.ts
├── pnpm-lock.yaml
└── pnpm-workspace.yaml
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": true,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: 🐞 Bug Report
2 | description: Create a bug report to help us improve
3 | title: "bug: "
4 | labels: ["🐞 unconfirmed bug"]
5 | body:
6 | - type: textarea
7 | attributes:
8 | label: Provide environment information
9 | description: |
10 | Run this command in your project root and paste the results:
11 | ```bash
12 | npx envinfo --system --binaries
13 | ```
14 |
15 | validations:
16 | required: true
17 | - type: textarea
18 | attributes:
19 | label: Describe the bug
20 | description: A clear and concise description of the bug, as well as what you expected to happen when encountering it.
21 | validations:
22 | required: true
23 | - type: input
24 | attributes:
25 | label: Reproduction repo
26 | description: If applicable, please provide a link to a reproduction repo or a Stackblitz / CodeSandbox project. Your issue may be closed if this is not provided and we are unable to reproduce the issue.
27 | - type: textarea
28 | attributes:
29 | label: Expected behavior
30 | description: A clear and concise description of what you expected to happen.
31 | validations:
32 | required: true
33 | - type: textarea
34 | attributes:
35 | label: Actual behavior
36 | description: A clear and concise description of what actually happened.
37 | validations:
38 | required: true
39 | - type: textarea
40 | attributes:
41 | label: Steps to reproduce
42 | description: Steps to reproduce the behavior.
43 | placeholder: |
44 | 1. Go to '...'
45 | 2. Click on '....'
46 | 3. Scroll down to '....'
47 | 4. See error
48 | validations:
49 | required: true
50 | - type: textarea
51 | attributes:
52 | label: Screenshots
53 | description: If applicable, add screenshots to help explain your problem.
54 | - type: textarea
55 | attributes:
56 | label: Additional context
57 | description: Add any other context about the problem here.
58 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Ask a Question
4 | url: https://discord.gg/uZ39dxhj
5 | about: Ask questions and discuss with other community members
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.yml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest an idea for this project
3 | title: "feat: "
4 | labels: ["🌟 enhancement"]
5 | body:
6 | - type: textarea
7 | attributes:
8 | label: Is your feature request related to a problem? Please describe.
9 | description: A clear and concise description of what the problem is.
10 | validations:
11 | required: true
12 | - type: textarea
13 | attributes:
14 | label: Describe the solution you'd like to see
15 | description: A clear and concise description of what you want to happen.
16 | validations:
17 | required: true
18 | - type: textarea
19 | attributes:
20 | label: Describe alternate solutions
21 | description: A clear and concise description of any alternative solutions or features you've considered.
22 | validations:
23 | required: true
24 | - type: textarea
25 | attributes:
26 | label: Additional information
27 | description: Add any other information related to the feature here. If your feature request is related to any issues or discussions, link them here.
28 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Fixes #
2 |
3 | # Description
4 |
5 | Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
6 | List any dependencies that are required for this change.
7 |
8 | ## Type of change
9 |
10 | Please mark relevant options with an `x` in the brackets.
11 |
12 | - [ ] Bug fix (non-breaking change which fixes an issue)
13 | - [ ] New feature (non-breaking change which adds functionality)
14 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
15 | - [ ] This change requires a documentation update
16 | - [ ] Algorithm update - updates algorithm documentation/questions/answers etc.
17 | - [ ] Other (please describe):
18 |
19 | # How Has This Been Tested?
20 |
21 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
22 | list any relevant details for your test configuration
23 |
24 | - [ ] Integration tests
25 | - [ ] Unit tests
26 | - [ ] Manual tests
27 | - [ ] No tests required
28 |
29 | # Reviewer checklist
30 |
31 | Mark everything that needs to be checked before merging the PR.
32 |
33 | - [ ] Check if the UI is working as expected and is satisfactory
34 | - [ ] Check if the code is well documented
35 | - [ ] Check if the behavior is what is expected
36 | - [ ] Check if the code is well tested
37 | - [ ] Check if the code is readable and well formatted
38 | - [ ] Additional checks (document below if any)
39 |
40 | # Screenshots (if appropriate):
41 |
42 | # Questions (if appropriate):
43 |
--------------------------------------------------------------------------------
/.github/workflows/publish-commit.yaml:
--------------------------------------------------------------------------------
1 | name: 🚀 pkg-pr-new
2 | on: [push, pull_request]
3 |
4 | concurrency:
5 | group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
6 | cancel-in-progress: true
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 |
11 | steps:
12 | - name: Checkout code
13 | uses: actions/checkout@v2
14 |
15 | - name: Install pnpm
16 | uses: pnpm/action-setup@v4
17 |
18 | - run: corepack enable
19 | - uses: actions/setup-node@v4
20 | with:
21 | node-version-file: "package.json"
22 |
23 | - name: Install dependencies
24 | run: pnpm install
25 |
26 | - name: Build
27 | run: pnpm run build
28 |
29 | - run: npx pkg-pr-new publish ./packages/*
30 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yaml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | release:
10 | name: Release
11 | runs-on: ubuntu-latest
12 | permissions:
13 | contents: write
14 | pull-requests: write
15 | actions: write
16 | id-token: write
17 | steps:
18 | - name: Checkout Repo
19 | uses: actions/checkout@v3
20 |
21 | - name: Install pnpm
22 | uses: pnpm/action-setup@v4
23 |
24 | - name: Setup Node.js
25 | uses: actions/setup-node@v3
26 | with:
27 | node-version-file: "package.json"
28 |
29 | - name: Install Dependencies
30 | run: pnpm install
31 |
32 | # - name: 🔐 Setup npm auth
33 | # run: |
34 | # echo "registry=https://registry.npmjs.org" >> ~/.npmrc
35 | # echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
36 |
37 | - name: Create Release Pull Request or Publish to npm
38 | id: changesets
39 | uses: changesets/action@v1
40 | env:
41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43 | with:
44 | title: "🚀 Release PR"
45 | commit: "chore: release"
46 | version: pnpm run version
47 | publish: pnpm run release
48 |
--------------------------------------------------------------------------------
/.github/workflows/pull-request.yaml:
--------------------------------------------------------------------------------
1 | name: 🚀 PR
2 |
3 | concurrency:
4 | group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
5 | cancel-in-progress: true
6 |
7 | on: [pull_request] # Run only on pull_request, to also get status updates in PRs. We omit push because this would run the steps two times (for push and pull_request).
8 |
9 | permissions:
10 | actions: write
11 | contents: read
12 | # Required to put a comment into the pull-request
13 | pull-requests: write
14 |
15 | jobs:
16 | lint:
17 | name: ⬣ Linting
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: actions/checkout@v4
21 | - uses: biomejs/setup-biome@v2
22 | - run: biome ci . --reporter=github
23 |
24 | typecheck:
25 | name: 🔎 Type check
26 | runs-on: ubuntu-latest
27 | steps:
28 | - name: 🛑 Cancel Previous Runs
29 | uses: styfle/cancel-workflow-action@0.12.1
30 |
31 | - name: ⬇️ Checkout repo
32 | uses: actions/checkout@v4
33 | - name: Install pnpm
34 | uses: pnpm/action-setup@v4
35 | - name: ⎔ Setup node
36 | uses: actions/setup-node@v4
37 | with:
38 | node-version-file: "package.json"
39 |
40 | - name: 📥 Download deps
41 | run: pnpm install
42 |
43 | - name: 🔎 Type check
44 | run: pnpm run typecheck
45 |
46 | vitest:
47 | name: ⚡ Unit Tests
48 | runs-on: ubuntu-latest
49 | steps:
50 | - name: 🛑 Cancel Previous Runs
51 | uses: styfle/cancel-workflow-action@0.12.1
52 |
53 | - name: ⬇️ Checkout repo
54 | uses: actions/checkout@v4
55 |
56 | - name: Install pnpm
57 | uses: pnpm/action-setup@v4
58 |
59 | - name: ⎔ Setup node
60 | uses: actions/setup-node@v4
61 | with:
62 | node-version-file: "package.json"
63 |
64 | - name: 📥 Download deps
65 | run: pnpm install
66 |
67 | - name: ⚡ Run vitest
68 | run: pnpm run test:cov
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 | .pnpm-debug.log*
9 |
10 | # Diagnostic reports (https://nodejs.org/api/report.html)
11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12 |
13 | # Runtime data
14 | pids
15 | *.pid
16 | *.seed
17 | *.pid.lock
18 |
19 | # Directory for instrumented libs generated by jscoverage/JSCover
20 | lib-cov
21 |
22 | # Coverage directory used by tools like istanbul
23 | coverage
24 | *.lcov
25 |
26 | # nyc test coverage
27 | .nyc_output
28 |
29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30 | .grunt
31 |
32 | # Bower dependency directory (https://bower.io/)
33 | bower_components
34 |
35 | # node-waf configuration
36 | .lock-wscript
37 |
38 | # Compiled binary addons (https://nodejs.org/api/addons.html)
39 | build/Release
40 |
41 | # Dependency directories
42 | node_modules/
43 | jspm_packages/
44 |
45 | # Snowpack dependency directory (https://snowpack.dev/)
46 | web_modules/
47 |
48 | # TypeScript cache
49 | *.tsbuildinfo
50 |
51 | # Optional npm cache directory
52 | .npm
53 |
54 | # Optional eslint cache
55 | .eslintcache
56 |
57 | # Optional stylelint cache
58 | .stylelintcache
59 |
60 | # Microbundle cache
61 | .rpt2_cache/
62 | .rts2_cache_cjs/
63 | .rts2_cache_es/
64 | .rts2_cache_umd/
65 |
66 | # Optional REPL history
67 | .node_repl_history
68 |
69 | # Output of 'npm pack'
70 | *.tgz
71 |
72 | # Yarn Integrity file
73 | .yarn-integrity
74 |
75 | # dotenv environment variable files
76 | .env
77 | .env.development.local
78 | .env.test.local
79 | .env.production.local
80 | .env.local
81 |
82 | # parcel-bundler cache (https://parceljs.org/)
83 | .cache
84 | .parcel-cache
85 |
86 | # Next.js build output
87 | .next
88 | out
89 |
90 | # Nuxt.js build / generate output
91 | .nuxt
92 | dist
93 |
94 | # Gatsby files
95 | .cache/
96 | # Comment in the public line in if your project uses Gatsby and not Next.js
97 | # https://nextjs.org/blog/next-9-1#public-directory-support
98 | # public
99 |
100 | # vuepress build output
101 | .vuepress/dist
102 |
103 | # vuepress v2.x temp and cache directory
104 | .temp
105 | .cache
106 |
107 | # Docusaurus cache and generated files
108 | .docusaurus
109 |
110 | # Serverless directories
111 | .serverless/
112 |
113 | # FuseBox cache
114 | .fusebox/
115 |
116 | # DynamoDB Local files
117 | .dynamodb/
118 |
119 | # TernJS port file
120 | .tern-port
121 |
122 | # Stores VSCode versions used for testing VSCode extensions
123 | .vscode-test
124 |
125 | # yarn v2
126 | .yarn/cache
127 | .yarn/unplugged
128 | .yarn/build-state.yml
129 | .yarn/install-state.gz
130 | .pnp.*
131 | /dist
132 | .history
133 | .react-router
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.defaultFormatter": "esbenp.prettier-vscode",
3 | "editor.formatOnSave": true,
4 | "javascript.format.enable": false,
5 | "javascript.suggest.autoImports": true,
6 | "javascript.suggest.paths": true,
7 | "typescript.format.enable": false,
8 | "typescript.suggest.paths": true,
9 | "typescript.suggest.autoImports": true,
10 | "editor.renderWhitespace": "all",
11 | "editor.rulers": [120, 160],
12 | "editor.codeActionsOnSave": {
13 | "source.fixAll": "always",
14 | "source.organizeImports": "never",
15 | "source.organizeImports.biome": "always",
16 | "quickfix.biome": "always"
17 | },
18 | "editor.insertSpaces": false,
19 | "editor.detectIndentation": true,
20 | "editor.trimAutoWhitespace": true,
21 | "files.trimTrailingWhitespace": true,
22 | "files.trimTrailingWhitespaceInRegexAndStrings": true,
23 | "files.trimFinalNewlines": true,
24 | "explorer.fileNesting.patterns": {
25 | "*.ts": "${basename}.*.${extname}",
26 | ".env": ".env.*",
27 | "*.tsx": "${basename}.*.${extname},${basename}.*.ts",
28 | "package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml"
29 | },
30 | "eslint.enable": false,
31 | "eslint.format.enable": false,
32 | }
33 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Forge 42
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # with-react
2 |
3 | 
4 | 
5 | 
6 | 
7 | 
8 | 
9 |
10 | A collection of React components that wrap React hooks to provide a more composable API. Each component accepts a render prop that receives the hook's return value.
11 |
12 | This enables a lot of features that previously violate the Rules of Hooks
13 |
14 | ## Conditional Hooks
15 |
16 | ```tsx
17 | function UserProfile({ user, showDetails }) {
18 | return (
19 |
20 |
{user.name}
21 |
22 |
23 | This is a really long description and there could be more markup
24 | or other components between here and the top of the component.
25 | Since hooks need to be declared at the top of the component function,
26 | instead of in the JSX, you may want to use WithState instead of useState
27 | just for colocation reasons.
28 |
43 | )
44 | }
45 | ```
46 |
47 |
48 | ## Hooks within loops
49 |
50 | This is a special case of conditional hooks, but sometimes you're rendering a lot of items in a loop and it's not worth creating a custom component for them because they require too much data from the parent scope.
51 |
52 | But then when you need to add some state to each one, React forces you to wrap it in a component. By using WithState, that component is provided for you and you can keep your list items owned by the parent.
53 |
54 | ```tsx
55 | const items = ['apple', 'banana', 'orange']
56 |
57 | function FruitList() {
58 | return (
59 |
71 | )
72 | }
73 | ```
74 |
75 | ## Form Status
76 |
77 | The `useFormStatus()` hook from react-dom treats any parent `
94 | )
95 | }
96 | ```
97 |
98 | ## Promise Resolution
99 |
100 | The `use()` hook can unwrap promises, but it must be used in a child of the suspense boundary it's meant to trigger. Since data is best fetched at the route level, these promises will almost always be naturally higher than the UI wheir their suspense boundary needs to be.
101 |
102 | The WithUse component allows you to pass a promise and get its resolved value directly within it.
103 |
104 | This use-case resembles [React Router's Await component](https://reactrouter.com/api/components/Await), which is a better name but I had to stick with the theme here.
105 |
106 | ```tsx
107 | function UserDetails() {
108 | return (
109 |