Skip to content

useData support

Compare
Choose a tag to compare
@dntzhang dntzhang released this 31 Oct 11:45
· 425 commits to master since this release
import { define, render } from 'omi'

define('my-counter', function() {
  const [count, setCount] = this.useData(0)

  return (
    <div>
      <button onClick={() => setCount(count - 1)}>-</button>
      <span>{count}</span>
      <button onClick={() => setCount(count + 1)}>+</button>
    </div>
  )
})

render(<my-counter />, 'body')