-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 docs content #2508
base: main
Are you sure you want to change the base?
Update docs content #2508
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
`createStore` returns a vanilla store with some API utilities. These API utilities are: `setState` | ||
function, `getState` function, and `subscribe` function. | ||
|
||
### `setState` function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like such functions like setState
should be in one place, with hyperlinks to them from, e.g., combine
function to avoid copying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sewera that's not supported with the current setup but when we migrate to vitepress we can move everything in one place and then just import them
@dai-shi lmk what you think about reference section and documentation, still working on usage and troubleshooting section but apart from that everything else should be done on reference section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the reference docs.
docs/reference/combine.md
Outdated
[`getState` function](#getstate-function) and [`storeApi`](#storeapi) as arguments. It should | ||
return an additional state based on the initial state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have those for combine
?
|
||
#### Returns | ||
|
||
`combine` returns a new state that is the result of merging the initial state and the additional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More precisely, combine
and any other middleware "returns" a state creator.
The `getState` function lets you access to the current state. It can be stale on asynchronous | ||
operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if "stale on async operations" is technically correct.
docs/reference/combine.md
Outdated
### `combine` Signature | ||
|
||
```ts | ||
combine<T, U>(initialState: T, additionalStateCreator: StateCreator<T, [], [], U>): Omit<T, keyof U> & U |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we clarify where we can import this from? combine
is from zustand/middleware
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a usage section where we can put it
@dai-shi thanks, working on that |
Also resolve conflicts please so that we can run CI. |
Sure |
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
@dai-shi would you mind review the latest changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on it!
|
||
### Updating objects and non-objects in state | ||
|
||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Cupiditate consectetur sequi repellendus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be written before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it will
arguments. | ||
- **optional** `devtoolsOptions`: An object to define Redux DevTools options. | ||
- **optional** `name`: A custom identifier for the connection in the Redux DevTools. | ||
- **optional** `enabled`: Defaults to `true`. Enables or disables the Redux DevTools integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default depends on if it's in DEV mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll update it
nav: 206 | ||
--- | ||
|
||
# immer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to install immer
.
### `create` Signature | ||
|
||
```ts | ||
create<T>()(stateCreatorFn: StateCreator<T, [], []>): UseBoundStore<StoreApi<T>> | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we could teach what a bound hook is.
Summary
Updating docs content
Check List
yarn run prettier
for formatting code and docs