We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f9fbb9 commit 9471b03Copy full SHA for 9471b03
react/providers/Encrypted/index.jsx
@@ -0,0 +1,25 @@
1
+import React, { useContext } from 'react'
2
+
3
+export const EncryptedContext = React.createContext()
4
5
+export const useEncrypted = () => {
6
+ const context = useContext(EncryptedContext)
7
8
+ if (!context) {
9
+ throw new Error('useEncrypted must be used within a EncryptedProvider')
10
+ }
11
+ return context
12
+}
13
14
+const EncryptedProvider = ({ url, children }) => {
15
+ const contextValue = {
16
+ url
17
18
+ return (
19
+ <EncryptedContext.Provider value={contextValue}>
20
+ {children}
21
+ </EncryptedContext.Provider>
22
+ )
23
24
25
+export default React.memo(EncryptedProvider)
0 commit comments