Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update deps #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# bs-use-fetch

A ReasonReact useFetch hook. It:
A React useFetch hook. It:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is one place where search-and-replace didn't quite work :)

Suggested change
A React useFetch hook. It:
- A React useFetch hook. It:
+ A useFetch hook for reason-react. It:

Feel free to reword :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye. At the very least, its being used as a learning tool!

Update with a Reason/Rescript React useFetch hook figuring the current state of the ecosystem. Let me know.

Thanks again.

- wraps [bs-fetch](https://github.com/reasonml-community/bs-fetch)
- is composable
- uses a `result` type
Expand All @@ -27,23 +27,23 @@ let make = () => {
// below, no distinction is made between fetching and refetching,
// but you're free to make other UX choices
fun
| Fetching => ReasonReact.string("Loading...")
| Fetching => React.string("Loading...")
| Refetching(Ok(({items}: GhRepo.t)))
| Complete(Ok(({items}: GhRepo.t))) =>
<ul>
{Belt.Array.map(items, ({fullName, htmlUrl}: GhRepo.repo) =>
<li key=fullName>
<a href=htmlUrl> {ReasonReact.string(fullName)} </a>
<a href=htmlUrl> {React.string(fullName)} </a>
</li>
)
->React.array}
</ul>
| Refetching(Error(`FetchError(_)))
| Complete(Error(`FetchError(_))) =>
<h2> {ReasonReact.string("Fetch error!")} </h2>
<h2> {React.string("Fetch error!")} </h2>
| Refetching(Error(`DecodeError((err: Decco.decodeError))))
| Complete(Error(`DecodeError((err: Decco.decodeError)))) =>
<h2> {ReasonReact.string("Decode error!")} </h2>
<h2> {React.string("Decode error!")} </h2>
);
};
```
Expand Down
1 change: 0 additions & 1 deletion bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
},
"bsc-flags": [ "-bs-no-version-header", "-bs-super-errors" ],
"ppx-flags": [ "decco/ppx"],
"refmt": 3,
"bs-dependencies": [ "bs-fetch", "decco", "reason-react" ],
"reason": {
"react-jsx": 3
Expand Down
14 changes: 7 additions & 7 deletions examples/basicExample.re
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ module Component = {
// below, no distinction is made between fetching and refetcsplithing,
// but you're free to make other UX choices
fun
| Fetching => ReasonReact.string("Loading...")
| Fetching => React.string("Loading...")
| Refetching(Ok(({items}: GhRepo.t)))
| Complete(Ok(({items}: GhRepo.t))) =>
<ul>
{Belt.Array.map(items, ({fullName, htmlUrl}: GhRepo.repo) =>
<li key=fullName>
<a href=htmlUrl> {ReasonReact.string(fullName)} </a>
<a href=htmlUrl> {React.string(fullName)} </a>
</li>
)
->React.array}
</ul>
| Refetching(Error(`FetchError(_)))
| Complete(Error(`FetchError(_))) =>
<div> {ReasonReact.string("Fetch error!")} </div>
<div> {React.string("Fetch error!")} </div>
| Refetching(Error(`DecodeError((err: Decco.decodeError))))
| Complete(Error(`DecodeError((err: Decco.decodeError)))) =>
<div>
<h2> {ReasonReact.string("Decode error!")} </h2>
<h2> {React.string("Decode error!")} </h2>
<ul>
<li> {ReasonReact.string(err.path)} </li>
<li> {ReasonReact.string(err.message)} </li>
<li> {ReasonReact.string(err.value->Js.Json.stringify)} </li>
<li> {React.string(err.path)} </li>
<li> {React.string(err.message)} </li>
<li> {React.string(err.value->Js.Json.stringify)} </li>
</ul>
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions examples/requestConstructorExample.re
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ let make = () => {
</div>
{switch (fetchResult) {
| Fetching
| Refetching(_) => ReasonReact.string("Loading...")
| Refetching(_) => React.string("Loading...")
| Complete(Error(_)) =>
<div> {ReasonReact.string("Something went wrong")} </div>
<div> {React.string("Something went wrong")} </div>
| Complete(Ok(({items}: GhRepo.t))) =>
<ul>
{Belt.Array.map(items, ({fullName, htmlUrl}: GhRepo.repo) =>
<li key=fullName>
<a href=htmlUrl> {ReasonReact.string(fullName)} </a>
<a href=htmlUrl> {React.string(fullName)} </a>
</li>
)
->React.array}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
},
"homepage": "https://github.com/hoichi/bs-use-fetch#readme",
"devDependencies": {
"bs-platform": "^7.0.1",
"decco": "^1.1.1",
"reason-react": "^0.7.0"
"bs-platform": "^9.0.2",
"decco": "^1.4.0",
"reason-react": "^0.9.1"
},
"peerDependencies": {
"reason-react": "^0.7.0"
"reason-react": "^0.9.1"
},
"dependencies": {
"bs-fetch": "^0.5.0"
"bs-fetch": "^0.6.2"
}
}
91 changes: 15 additions & 76 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,22 @@
# yarn lockfile v1


bs-fetch@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/bs-fetch/-/bs-fetch-0.5.0.tgz#6913b1d1ddfa0b0a4b832357854e9763d61d4b28"
integrity sha512-cGjwRpyNcIaX+p2ssy/38zs7BM/miKNgmOR3NEhxKFete5mR05JcvjuV4raG89oGCG281SU1b56TTAKmf9VCug==
bs-fetch@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/bs-fetch/-/bs-fetch-0.6.2.tgz#37d982e9f79b9bc44c23e87ae78ccbee1f869adf"
integrity sha512-VXEjp8kY3vHPckaoy3d96Bx0KYjJAPLNISBwfpwMN26K6DtuZYwI2HKhx7zeHBajz1bRArfx7O8OOLcdtujMvg==

bs-platform@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-7.0.1.tgz#1d7b0ef6088b998dceee5db74a7cd8f01c20a3bd"
integrity sha512-UjStdtHhbtC/l6vKJ1XRDqrPk7rFf5PLYHtRX3akDXEYVnTbN36z0g4DEr5mU8S0N945e33HYts9x+i7hKKpZQ==
bs-platform@^9.0.2:
version "9.0.2"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-9.0.2.tgz#a6eac70eb8924a322556dacaccbfbc9b2a0d3a37"
integrity sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==

decco@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/decco/-/decco-1.1.1.tgz#69e252c3bdf1b6f4f10dd115ba44f25908d0033c"
integrity sha512-hif221MrEzLcjguORCYml7CAfCwWap6HuRI4x0G9TSLRoJkkDKc/Qx01JleOzMubOWFK4dbJNmKXR4+S/r3obw==

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

loose-envify@^1.1.0, loose-envify@^1.4.0:
decco@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=

prop-types@^15.6.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
dependencies:
loose-envify "^1.4.0"
object-assign "^4.1.1"
react-is "^16.8.1"

react-dom@>=16.8.1:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11"
integrity sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.18.0"

react-is@^16.8.1:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==

react@>=16.8.1:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83"
integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"

reason-react@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.0.tgz#46a975c321e81cd51310d7b1a02418ca7667b0d6"
integrity sha512-czR/f0lY5iyLCki9gwftOFF5Zs40l7ZSFmpGK/Z6hx2jBVeFDmIiXB8bAQW/cO6IvtuEt97OmsYueiuOYG9XjQ==
dependencies:
react ">=16.8.1"
react-dom ">=16.8.1"
resolved "https://registry.yarnpkg.com/decco/-/decco-1.4.0.tgz#38578e1edce9f4febda3b429312b95a3f0d0807d"
integrity sha512-LjzKnysrmFqkzzRD4w8yb5IfTvMh3grNUJQqVKhp+lv+8KcoXx2AUIvLsFBwamBxAwKc6il3ZJc90i0ZWxSosQ==

scheduler@^0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.18.0.tgz#5901ad6659bc1d8f3fdaf36eb7a67b0d6746b1c4"
integrity sha512-agTSHR1Nbfi6ulI0kYNK0203joW2Y5W4po4l+v03tOoiJKpTBbxpNhWDvqc/4IcOw+KLmSiQLTasZ4cab2/UWQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
reason-react@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0"
integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==