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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] 馃殌 Better API documentation #206

Open
KL13NT opened this issue Oct 9, 2020 · 16 comments
Open

[Request] 馃殌 Better API documentation #206

KL13NT opened this issue Oct 9, 2020 · 16 comments
Labels
help wanted Please someone help on this

Comments

@KL13NT
Copy link

KL13NT commented Oct 9, 2020

Description

The source code lacks proper API documentation for the internal methods available, limiting contribution.

Context

It seems to me that the code lacks proper documentation, making contribution harder. I tried to create my own zustand-like store/hooks in an experiment project I'm working on (I'm trying to not use libraries) but I failed. When I came over to the repo to inspect the code and follow along I was greeted by a lot of TS (I'm coming from a Vanilla JS background), none of the internal methods had proper documentation at all.

I tried to follow with how the code works but there are just too many imports/exports, TS type declarations, and internals that are hard to follow without actual explanation of their behaviour/role. This makes reading and following along the code harder, thus limiting contribution.

Request

A few JSDoc-like comments would be a huge help. All I need is a reference of sorts to know which methods do what. I don't wanna sound like it's a "must", I just need such documentation. I would create a PR for this if anyone's willing to guide me around as well.

@dai-shi dai-shi added the help wanted Please someone help on this label Oct 9, 2020
@dai-shi
Copy link
Member

dai-shi commented Oct 9, 2020

I can answer some questions if you ask me specifically here. Please don't ask many things at once. Let's start with a few important ones for you.

@Saulius-HALO
Copy link

@dai-shi Hello,

export const useStore = create(...
Does this create a new store instance every single time when const state = useStore(); is used? If so any suggestions how to properly mitigate it in react? Use providers or something?

@dai-shi
Copy link
Member

dai-shi commented Mar 22, 2021

export const useStore = create(...
Does this create a new store instance every single time when const state = useStore(); is used? If so any suggestions how to properly mitigate it in react? Use providers or something?

It will create a store only when create is called.
useStore doesn't create a new store.

@dai-shi
Copy link
Member

dai-shi commented Mar 22, 2021

Hi folks,
Please allow me to close this issue as stale. It's not very actionable and at least some developers have no issues reading the code and making contributions.

@Saulius-HALO If you need more help, would you please open a new discussion?

@dai-shi dai-shi closed this as completed Mar 22, 2021
@darkocejkov
Copy link

Apologies, but that doesn't satisfy me at all. Zustand is SO great but the lack of even a simple API reference makes it much harder to use idiomatically, especially when in conjunction with other packages. I would highly recommend even the simplest technical reference, as it's much more difficult to answer specific questions in a discussion board for both any maintainers and developers using Zustand.

@dai-shi
Copy link
Member

dai-shi commented Dec 20, 2023

@dbritto-dev @charkour Any idea for API docs or a technical reference?

@darkocejkov Do you have any example in other projects that provides what you expect?

@darkocejkov
Copy link

@dai-shi Of course! Some of my favorites I've used are:

Essentially, what I would like to see is more of a technical detail to what functions return, what is expected for arguments, etc. Kind of like a type declaration file but less bogged down by complex types.
Thank you for replying by the way, I appreciate it very much!

@dai-shi
Copy link
Member

dai-shi commented Dec 20, 2023

I see. I thought it's more about internal things. But they are more like usage docs.
I'm pretty sure @dbritto-dev @charkour and others can help on it.

@dbritto-dev
Copy link
Collaborator

@dai-shi yeah, I've been thinking on that a lot and I guess we can add it to v5 since we are cleaning the API. any thoughts @charkour? I would like to help with that

@dai-shi
Copy link
Member

dai-shi commented Dec 20, 2023

I don't think we need to wait for v5. API doesn't change. v5 may take a long time.

@dbritto-dev
Copy link
Collaborator

@dai-shi in that case I would like to help to kick out v5 as soon as possible

@dai-shi
Copy link
Member

dai-shi commented Dec 20, 2023

It's not blocked by our effort. I would like to get as many feedback as possible before the final release. That's what I learned from v4. And, it should not stop improving docs.

@charkour
Copy link
Collaborator

charkour commented Dec 21, 2023

@dbritto-dev, you can lead the docs efforts and I would be happy to help. However, the readme documentation is sufficient in my opinion, I don't yet understand the benefits of making usage docs different than what we have on the readme and other markdown files.

@dai-shi
Copy link
Member

dai-shi commented Mar 4, 2024

reopening this.

@dai-shi dai-shi reopened this Mar 4, 2024
@dbritto-dev
Copy link
Collaborator

Hey peeps I'm going to retake this

@dbritto-dev
Copy link
Collaborator

Hi folks, some news I'm working on revamping docs but on my repo until is done -> dbritto-dev#1, btw you can follow the discussion here -> #2489

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

No branches or pull requests

6 participants