Skip to content

updating useAsyncStorage syntax #4

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

Merged
merged 6 commits into from
Feb 19, 2021
Merged

updating useAsyncStorage syntax #4

merged 6 commits into from
Feb 19, 2021

Conversation

idkjs
Copy link
Contributor

@idkjs idkjs commented Nov 22, 2020

Lets user do:

ReactNativeAsyncStorage.asyncStorageState

type asyncStorageState = {
  getItem: unit => Js.Promise.t(Js.Null.t(string)),
  setItem: string => Js.Promise.t(unit),
  mergeItem: string => Js.Promise.t(unit),
  removeItem: unit => Js.Promise.t(unit),
};

let key = "@@Key"
 let ReactNativeAsyncStorage.{getItem, setItem} =
    ReactNativeAsyncStorage.useAsyncStorage("@@Key");

Instead of

 let useAsyncStorage=
    ReactNativeAsyncStorage.useAsyncStorage("@@Key");

let getItem =useAsyncStorage##getItem;

See updated README.md

@idkjs idkjs requested review from MoOx and tatchi and removed request for MoOx November 22, 2020 16:58
@idkjs idkjs requested a review from tatchi December 3, 2020 11:29
@tatchi tatchi requested a review from MoOx December 8, 2020 20:35
Copy link
Member

@MoOx MoOx left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! Could the example be more straight forward without styles for example? To avoid unecessary noise so the developer can focus on the actual interesting code, thanks!

@idkjs
Copy link
Contributor Author

idkjs commented Jan 11, 2021

@MoOx #4 (review) done

@idkjs idkjs requested a review from MoOx January 11, 2021 11:41
@MoOx
Copy link
Member

MoOx commented Feb 19, 2021

I removed example as they were way to complex to quickly illustrate how to use the hook. If you want to another PR, but without UI & faker & unecessary stuff for the developer to understand the core of the usage.

@MoOx MoOx merged commit 78387c7 into master Feb 19, 2021
@MoOx MoOx deleted the update-useAsyncStorage branch February 19, 2021 13:56
MoOx added a commit that referenced this pull request Feb 19, 2021
@MoOx
Copy link
Member

MoOx commented Feb 19, 2021

I rolled back the change and added record syntax as useAsyncStorage_ with a deprecation notice for old syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants