Closed krispya closed 2 weeks ago
Following Zustand's lead, I am looking to do this instead:
import { actions } from 'koota'
import { useActions } from 'koota/react'
const actions = createActions((world) => {})
// Vanilla use
const { spawnPlayer } = actions(world)
// React use
const { spawnPlayer } = useActions(actions)
Right now
createActions
lives in the React package and gets used as a hook.And then can be used in vanilla with an additional API call that binds world to the actions manually.
This was inspired by the Zustand API but it turns out actions are really useful for vanilla making me think it is better to flip this around and make it a core export that always takes a world to bind.