Skip to content

Commit

Permalink
docs: update state API
Browse files Browse the repository at this point in the history
  • Loading branch information
Massolari committed Aug 26, 2024
1 parent f9e7dff commit 763a4c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Here's a basic example of how to use Pink:
```gleam
import pink
import pink/attribute
import pink/hook
import pink/state
pub fn main() {
// Create a new React component (we need this to use hooks)
use <- pink.component()
// Initialize a state (this is React's useState hook)
let message = hook.state("World")
let message = state.init("World")
// Create a box with a border and a text component inside
pink.box([attribute.border_style(attribute.BorderSingle)], [
pink.text([], "Hello, " <> message.value)
pink.text([], "Hello, " <> state.get(message))
])
}
```

0 comments on commit 763a4c3

Please sign in to comment.