BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/optics/get-strict-context

Get strict context

optics/get-strict-context
FreeUtility

Library utility: get-strict-context

See it running

Open the demo on optics

optics.agusmayol.com.ar/components/get-strict-context
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://optics.agusmayol.com.ar/r/get-strict-context.json

Source

registry/optics/lib/get-strict-context.jsxoptics.agusmayol.com.ar/r/get-strict-context.json
1import * as React from "react";
2
3function getStrictContext(name) {
4 const Context = React.createContext(undefined);
5
6 const Provider = ({ value, children }) => (
7 <Context.Provider value={value}>{children}</Context.Provider>
8 );
9
10 const useSafeContext = () => {
11 const ctx = React.useContext(Context);
12 if (ctx === undefined) {
13 throw new Error(`useContext must be used within ${name ?? "a Provider"}`);
14 }
15 return ctx;
16 };
17
18 return [Provider, useSafeContext];
19}
20
21export { getStrictContext };

Files it writes

  • registry/optics/lib/get-strict-context.jsx

Facts

Registry
optics
Type
registry:lib
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on optics optics.agusmayol.com.ar AgusMayol/optics on GitHub Raw registry item This item as JSON

More from optics

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Cursor Rule: Back Endcursor-rule-back-endopticsUtilitiesFreeno deps
Cursor Rule: Bulk Processingcursor-rule-bulk-processingopticsUtilitiesFreeno deps
Cursor Rule: Commits Conventioncursor-rule-commits-conventionopticsUtilitiesFreeno deps
Cursor Rule: Front Endcursor-rule-front-endopticsUtilitiesFreeno deps
Cursor Rule: Generalcursor-rule-generalopticsUtilitiesFreeno deps
Cursor Rule: React Optimizationcursor-rule-react-optimizationopticsUtilitiesFreeno deps
Cursor Rule: Web Interface Guidelinescursor-rule-web-interface-guidelinesopticsUtilitiesFreeno deps
Use auto heightuse-auto-heightopticsUtilitiesFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex