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

What is the meaning of E in State<S, E>? #390

Open
onhernandes opened this issue May 1, 2023 · 1 comment
Open

What is the meaning of E in State<S, E>? #390

onhernandes opened this issue May 1, 2023 · 1 comment

Comments

@onhernandes
Copy link

I've been trying to implement an extension like localstored, but with a better approach for onSet + using react-native-async-storage. On every plugin in this repo there's a declaration of State<S, E>. As far as I know, S stands for the type of the value itself, but what about E? What does it mean? How should I use it?

obs> My extension won't be needing other extensions.

@avkonst
Copy link
Owner

avkonst commented May 1, 2023

E is a final merge of extension methods and props from all extensions added to the state. Most of the time it is inferred automatically from the attached extension.
Your extension might have E as only {} if you do not need extension methods.
Also have a look at the existing localstored, it allows to pass storage engine, which I believe is async capable.
If you have any questions regarding development of the extension feel free to ask. If you feel your extension is generic enough, you may include it to the hookstate repo

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

No branches or pull requests

2 participants