Skip to content

Commit a063aec

Browse files
0 parents  commit a063aec

20 files changed

+23185
-0
lines changed

.babelrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env", {
4+
"modules": false
5+
}],
6+
"@babel/preset-react"
7+
],
8+
"plugins": ["@babel/plugin-proposal-class-properties"]
9+
}

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintrc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": [
4+
"standard",
5+
"standard-react"
6+
],
7+
"env": {
8+
"es6": true
9+
},
10+
"plugins": [
11+
"react"
12+
],
13+
"parserOptions": {
14+
"sourceType": "module"
15+
},
16+
"rules": {
17+
// don't force es6 functions to include space before paren
18+
"space-before-function-paren": 0,
19+
20+
// allow specifying true explicitly for boolean props
21+
"react/jsx-boolean-value": 0
22+
}
23+
}

.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# See https://help.github.com/ignore-files/ for more about ignoring files.
3+
4+
# dependencies
5+
node_modules
6+
7+
# builds
8+
build
9+
dist
10+
.rpt2_cache
11+
12+
# misc
13+
.DS_Store
14+
.env
15+
.env.local
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
19+
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- 9
4+
- 8

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# react-context-hook
2+
3+
> A React.js global state manager with Hooks and Context API
4+
5+
[![NPM](https://img.shields.io/npm/v/react-context-hook.svg)](https://www.npmjs.com/package/react-context-hook) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6+
7+
## Install
8+
9+
```bash
10+
npm install --save react-context-hook
11+
```
12+
13+
## Usage
14+
15+
```jsx
16+
import React, { Component } from 'react'
17+
18+
import { useMyHook } from 'react-context-hook'
19+
20+
const Example = () => {
21+
const example = useMyHook()
22+
return (
23+
<div>{example}</div>
24+
)
25+
}
26+
```
27+
28+
## License
29+
30+
MIT © [Spyna](https://github.com/Spyna)
31+
32+
---
33+
34+
This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).

example/README.md

+2,026
Large diffs are not rendered by default.

example/package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "react-context-hook-example",
3+
"homepage": "https://Spyna.github.io/react-context-hook",
4+
"version": "0.0.0",
5+
"license": "MIT",
6+
"private": true,
7+
"dependencies": {
8+
"prop-types": "^15.6.2",
9+
"react": "link:../node_modules/react",
10+
"react-dom": "^16.8.6",
11+
"react-scripts": "^3.0.1",
12+
"react-context-hook": "link:.."
13+
},
14+
"scripts": {
15+
"start": "react-scripts start",
16+
"build": "react-scripts build",
17+
"test": "react-scripts test --env=jsdom",
18+
"eject": "react-scripts eject"
19+
},
20+
"browserslist": [
21+
">0.2%",
22+
"not dead",
23+
"not ie <= 11",
24+
"not op_mini all"
25+
]
26+
}

example/public/index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
8+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
9+
10+
<title>react-context-hook</title>
11+
</head>
12+
13+
<body>
14+
<noscript>
15+
You need to enable JavaScript to run this app.
16+
</noscript>
17+
18+
<div id="root"></div>
19+
</body>
20+
</html>

example/public/manifest.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"short_name": "react-context-hook",
3+
"name": "react-context-hook",
4+
"start_url": "./index.html",
5+
"display": "standalone",
6+
"theme_color": "#000000",
7+
"background_color": "#ffffff"
8+
}

example/src/App.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { useMyHook } from 'react-context-hook'
3+
4+
const App = () => {
5+
const example = useMyHook()
6+
return (
7+
<div>
8+
{example}
9+
</div>
10+
)
11+
}
12+
export default App

example/src/index.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: sans-serif;
5+
} */

example/src/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
4+
import './index.css'
5+
import App from './App'
6+
7+
ReactDOM.render(<App />, document.getElementById('root'))

0 commit comments

Comments
 (0)