Skip to content

Commit

Permalink
doc: Update UseAsyncState and UseReducer documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
CarLeonDev committed May 22, 2024
1 parent c22d91b commit b21abdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions website/src/content/docs/hooks/use_async_state.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class UserController {
this,
);
UserController(required this.userId) {
UserController(this.userId) {
uUser.resolve(this.userId);
}
Expand Down Expand Up @@ -195,7 +195,6 @@ final translateState = UseAsyncState.withArg<String?, ArgsX3<String>>(
);
```


### Using `when` method

<HT>`UseAsyncState`</HT> provides a <HM>`when`</HM> method that allows to computed a value depending on its status:
Expand Down
6 changes: 4 additions & 2 deletions website/src/content/docs/hooks/use_reducer.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: UseReducer
description: The useReducer hook is a more advanced way to manage state in Reactter.
sidebar:
order: 3
---
import { HM, HT } from '@/components/Highlight';
import { Code } from "@astrojs/starlight/components";
Expand All @@ -13,7 +15,7 @@ import * as ListeningChangesState from '@/content/docs/shareds/listening_changes

export const mark = ["UserAction", "UseReducer", "ReactterAction", /([^u]User)/g, "reducer", ".dispatch", ".value"];

<HT><a href="https://pub.dev/documentation/reactter/latest/reactter/UseReducer-class.html" target="_blank">`UseReducer`</a></HT> is a [hook](/reactter/core_concepts/hooks) that manages state using reducer method.
<HT><a href="https://pub.dev/documentation/reactter/latest/reactter/UseReducer-class.html" target="_blank">`UseReducer`</a></HT> is a [hook](/reactter/core_concepts/hooks) that manages state using reducer function.
An alternative to <HT>[`UseState`](/reactter/hooks/use_state)</HT>.

:::tip
Expand Down Expand Up @@ -66,7 +68,7 @@ class UserController {
this,
);
UserController(required this.userId);
UserController(this.userId);
User? reducer(User? state, ReactterAction action) {
if (action is IncrementedEgeUserAction) {
Expand Down

0 comments on commit b21abdb

Please sign in to comment.