Skip to content

Commit

Permalink
improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kepta committed Oct 8, 2023
1 parent 5ea36c7 commit 1dab943
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
7 changes: 1 addition & 6 deletions documentation/pages/docs/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ function setUserData(data) {
}

export const userDataSlice = key.slice({
actions: {
setUserData,
},
fields: {
// ...
},
setUserData,
});
```

Expand Down
12 changes: 4 additions & 8 deletions documentation/pages/docs/api/key.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ Creates a new [slice](./slice) object.
Signature:

```ts
key.slice({ fields: { Fields }, actions: { Actions } });
key.slice({ ...fields, ...actions });
```

Arguments:

- `fields` - An object containing the fields you to expose externally.

- `actions` - An object containing the actions you to expose externally.
- `object`: An object containing the fields or actions you want to expose externally.

Returns:

Expand All @@ -117,12 +115,10 @@ Example:

```ts
export const countSlice = key.slice({
fields: {
// fields
count,
},
actions: {
// actions
increment,
},
});
```

Expand Down
8 changes: 3 additions & 5 deletions documentation/pages/docs/selectors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ const timesSixField = key.derive((state) => {
});

export const mySlice = key.slice({
fields: {
counter: counterField,
double: doubleField,
timesSix: timesSixField,
},
counter: counterField,
double: doubleField,
timesSix: timesSixField,
});

key.effect((store) => {
Expand Down
16 changes: 4 additions & 12 deletions documentation/pages/docs/slice.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ function loginUser() {

// Only export the slice
export const loginSlice = key.slice({
fields: {
isLoggedIn,
},
actions: {
loginUser,
},
isLoggedIn,
loginUser,
});
```

Expand Down Expand Up @@ -82,12 +78,8 @@ function setUserName(userName) {
}

export const userSlice = key.slice({
fields: {
userName: userNameField,
},
actions: {
setUserName,
},
userName: userNameField,
setUserName,
});
```

Expand Down

0 comments on commit 1dab943

Please sign in to comment.