Skip to content

Commit 8b08361

Browse files
authored
Use context api (#9)
Use context api
2 parents 1b83d00 + ec666fb commit 8b08361

17 files changed

+3830
-10866
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ node_modules
88
build
99
dist
1010
.rpt2_cache
11+
.rts2_cache_cjs
12+
.rts2_cache_es
13+
.rts2_cache_umd
1114

1215
# misc
1316
.DS_Store

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
99

10+
## [v0.1.0](https://github.com/sw-yx/react-netlify-identity/compare/v0.0.16...v0.1.0) - 2019-05-30
11+
12+
### Commits
13+
14+
- working contextapi [`149fccf`](https://github.com/sw-yx/react-netlify-identity/commit/149fccf91317ffade6b5468c19cdfcc333cf245d)
15+
- update version [`013e1fd`](https://github.com/sw-yx/react-netlify-identity/commit/013e1fdf8fe2a74c5844af5b87221d224e51f3be)
16+
1017
## [v0.0.16](https://github.com/sw-yx/react-netlify-identity/compare/v0.0.15...v0.0.16) - 2019-05-22
1118

1219
### Commits

README.md

+5-15
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ function Login() {
8181
const email = formRef.current.email.value
8282
const password = formRef.current.password.value
8383
signupUser(email, password)
84-
.then(user => {
84+
.then((user) => {
8585
console.log("Success! Signed up", user)
8686
navigate("/dashboard")
8787
})
88-
.catch(err => console.error(err) || setMsg("Error: " + err.message))
88+
.catch((err) => console.error(err) || setMsg("Error: " + err.message))
8989
}
9090
return (
9191
<form
9292
ref={formRef}
93-
onSubmit={e => {
93+
onSubmit={(e) => {
9494
e.preventDefault()
9595
const email = e.target.email.value
9696
const password = e.target.password.value
9797
load(loginUser(email, password, true))
98-
.then(user => {
98+
.then((user) => {
9999
console.log("Success! Logged in", user)
100100
navigate("/dashboard")
101101
})
102-
.catch(err => console.error(err) || setMsg("Error: " + err.message))
102+
.catch((err) => console.error(err) || setMsg("Error: " + err.message))
103103
}}
104104
>
105105
<div>
@@ -174,16 +174,6 @@ function Dashboard() {
174174

175175
</details>
176176

177-
**As a render prop**: This is also exported as a render prop component, `NetlifyIdentity`, but we're not quite sure if its that useful if you can already use hooks in your app:
178-
179-
```tsx
180-
<NetlifyIdentity domain="https://mydomain.netlify.com">
181-
{({ loginUser, signupUser }) => {
182-
// use it
183-
}}
184-
</NetlifyIdentity>
185-
```
186-
187177
## License
188178

189179
MIT © [sw-yx](https://github.com/sw-yx)

example/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7-
7+
.cache
88
# testing
99
/coverage
1010

example/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8" />
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
6+
<title>Playground</title>
7+
</head>
8+
9+
<body>
10+
<div id="root"></div>
11+
<script src="./src/index.tsx"></script>
12+
</body>
13+
</html>

example/package.json

+19-31
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,29 @@
11
{
22
"name": "example",
3-
"version": "0.1.0",
4-
"private": true,
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"start": "parcel index.html",
8+
"build": "parcel build index.html"
9+
},
510
"dependencies": {
611
"@reach/router": "^1.2.1",
12+
"react-app-polyfill": "^1.0.1",
713
"react-netlify-identity": "latest",
8-
"react-scripts": "3.0.0",
14+
"react": "latest",
15+
"react-dom": "latest",
916
"typescript": "3.4.5"
1017
},
11-
"scripts": {
12-
"start": "react-scripts start",
13-
"build": "react-scripts build",
14-
"test": "react-scripts test",
15-
"eject": "react-scripts eject"
16-
},
17-
"eslintConfig": {
18-
"extends": "react-app"
19-
},
20-
"browserslist": {
21-
"production": [
22-
">0.2%",
23-
"not dead",
24-
"not op_mini all"
25-
],
26-
"development": [
27-
"last 1 chrome version",
28-
"last 1 firefox version",
29-
"last 1 safari version"
30-
]
31-
},
3218
"devDependencies": {
33-
"@types/jest": "24.0.11",
34-
"@types/node": "11.13.8",
3519
"@types/reach__router": "^1.2.4",
36-
"@types/react": "16.8.14",
37-
"@types/react-dom": "16.8.4",
38-
"react": "^16.8.6",
39-
"react-dom": "^16.8.6"
40-
}
20+
"@types/react": "^16.8.15",
21+
"@types/react-dom": "^16.8.4",
22+
"parcel": "^1.12.3",
23+
"typescript": "^3.4.5"
24+
},
25+
"browserslist": [
26+
"last 1 chrome version",
27+
"not dead"
28+
]
4129
}

0 commit comments

Comments
 (0)