Methods
# createState(name) → {State}
Creates a state with a given name, the state is created
unbound
Parameters:
Name | Type | Description |
---|---|---|
name |
string | a name for the state |
Example
const state = createState("global")
const {Bind, bind} = state
const Input = bind({component: <TextField variant="outlined"/>})
const stateObject = {title: "global"}
function App() {
return <Bind target={stateObject}>
<Inner/>
</Bind>
}
function Inner() {
return <div>
<Input property="title" label="title"/>
<Input property="somethingElse" label="other" defaultValue=""/>
</div>
}
Type Definitions
# ChangeEvent(target)
Used to notify of events
Parameters:
Name | Type | Description |
---|---|---|
target |
object | the target that has been changed |
# Extractor(event) → {any}
Parameters:
Name | Type | Description |
---|---|---|
event |
any | the parameter of the event handler |
the extracted value
any
# HandlePreparer(handlers)
Parameters:
Name | Type | Description |
---|---|---|
handlers |
Array.<function()> | the handlers being used |
an updated array or the original array sorted
# TransformValue(value) → {any}
Parameters:
Name | Type | Description |
---|---|---|
value |
any | the value to be transformed |
the transformed value
any