You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/content/docs/api/classes/rt_state.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,9 @@ abstract class RtState<E extends RtState<E>> {
40
40
### Declaration
41
41
42
42
To create a custom state, extend the <HT>`RtState`</HT> class and define the state properties and methods.
43
-
Register the state using <HM>[`Rt.createState`](/reactter/api/methods/state_management_methods/#rtcreatestate)</HM> or as a dependency within the Reactter framework, e.g.:
43
+
Register the state using <HM>[`Rt.registerState`](/reactter/api/methods/state_management_methods/#rtregisterstate)</HM> or as a dependency within the Reactter framework, e.g.:
@@ -112,7 +112,7 @@ class MyState extends RtState<MyState> {
112
112
MyState._([int value = 0]) : _value = value;
113
113
114
114
factory MyState(int value) {
115
-
return Rt.createState(() => MyState._(value)); // Register state
115
+
return Rt.registerState(() => MyState._(value)); // Register state
116
116
}
117
117
}
118
118
@@ -132,7 +132,7 @@ When a state is updated, it emits the following lifecycle events:
132
132
- <HE>`Lifecycle.willUpdate`</HE> event is triggered before the callback function of <HM>`update`</HM> method have been executed.
133
133
- <HE>`Lifecycle.didUpdate`</HE> event is triggered after the callback function of <HM>`update`</HM> method have been executed or after the <HM>`notify`</HM> method have been invoked.
Copy file name to clipboardExpand all lines: website/src/content/docs/api/methods/state_management_methods.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,28 +64,28 @@ void main() {
64
64
In the example, the `uCount` state is lazily declared inside the <HT>`CountController`</HT> class using <HM>`Rt.lazyState`</HM>. It's accessed after creating the <HT>`CountController`</HT> instance, and when the instance is deleted, the state is automatically disposed, ensuring efficient resource management.
65
65
66
66
67
-
## <HM>`Rt.createState`</HM>
67
+
## <HM>`Rt.registerState`</HM>
68
68
69
-
<HM>`Rt.createState`</HM> is a method that allows to register a <HT>[`RtState`](/reactter/api/classes/rt_state)</HT> instance.
69
+
<HM>`Rt.registerState`</HM> is a method that allows to register a <HT>[`RtState`](/reactter/api/classes/rt_state)</HT> instance.
70
70
All states created must be registered using this method for proper management and disposal.
71
71
72
72
:::note
73
-
In most cases, you don't need to manually use the `Rt.createState` method to create a state when using `RtHook` or `Signal` classes, as they automatically handle the registration of the state instance.
73
+
In most cases, you don't need to manually use the <HM>`Rt.registerState`</HM> method to create a state when using <HT>[`RtHook`](/reactter/api/classes/rt_hook)</HT> or <HT>[`Signal`](/reactter/api/classes/signal)</HT> classes, as they automatically handle the registration of the state instance.
74
74
75
-
However, if you're creating a custom state using the `RtState` class directly, you **must** use `Rt.createState` to properly register the state instance.
75
+
However, if you're creating a custom state using the <HT>[`RtState`](/reactter/api/classes/rt_state)</HT> class directly, you **must** use <HM>`Rt.registerState`</HM> to properly register the state instance.
76
76
:::
77
77
78
78
#### Syntax
79
79
80
80
```dart showLineNumbers=false
81
-
T Rt.createState<T extends RtState>(T stateFn());
81
+
T Rt.registerState<T extends RtState>(T stateFn());
82
82
```
83
83
84
84
#### Example
85
85
86
-
In this example, the custom state using <HT>[`RtState`](/reactter/api/classes/rt_state)</HT> class is created and registered using <HM>`Rt.createState`</HM> method.
86
+
In this example, the custom state using <HT>[`RtState`](/reactter/api/classes/rt_state)</HT> class is created and registered using <HM>`Rt.registerState`</HM> method.
0 commit comments