@weser/context 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +1 -51
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,53 +1,3 @@
1
1
  # @weser/context
2
2
 
3
- <img alt="npm version" src="https://badge.fury.io/js/@weser%2Fcontext.svg"> <img alt="npm downloads" src="https://img.shields.io/npm/dm/@weser/context.svg"> <a href="https://bundlephobia.com/result?p=@weser/context@latest"><img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/@weser/context.svg"></a>
4
-
5
- ## Installation
6
-
7
- ```sh
8
- # npm
9
- npm i --save @weser/context
10
- # yarn
11
- yarn add @weser/context
12
- # pnpm
13
- pnpm add @weser/context
14
- ```
15
-
16
- ## Documentation
17
-
18
- ### `createContext<T>`
19
-
20
- #### Parameters
21
-
22
- | Parameter | Type | Default | Description |
23
- | ------------ | --------- | ------- | -------------------------------------------------------- |
24
- | defaultValue | `T` | `null` | The default value for when no provider is used |
25
- | name |  `string` | `""` | (Optional) A name for the context used in error messages |
26
-
27
- ```tsx
28
- import { createContext } from '@weser/context'
29
-
30
- type Theme = 'light' | 'dark'
31
-
32
- const [useTheme, ThemeProvider] = createContext<Theme>('light', 'theme')
33
-
34
- function App({ children }) {
35
- return <ThemeProvider value="dark">{children}</ThemeProvider>
36
- }
37
-
38
- function Component() {
39
- const theme = useTheme()
40
-
41
- return (
42
- <div style={{ backgroundColor: theme === 'dark' ? 'black' : 'white' }}>
43
- Hello
44
- </div>
45
- )
46
- }
47
- ```
48
-
49
- ## License
50
-
51
- @weser/context is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>
52
- Documentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>
53
- Created with ♥ by [@robinweser](http://weser.io).
3
+ [Documentation](https://packages.weser.io/context)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weser/context",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "React helpers for working with context",
5
5
  "author": "Robin Weser <robin@weser.io>",
6
6
  "license": "MIT",
@@ -53,5 +53,5 @@
53
53
  "rimraf": "^3.0.2",
54
54
  "typescript": "^5.4.5"
55
55
  },
56
- "gitHead": "2844a44c54a0ada9f675baf40226f87fe894c29f"
56
+ "gitHead": "7b2bc4fa318330eb2031b0d1835554a8a9f0f6bd"
57
57
  }