Skip to main content

Hooks

Functions

useArray

Hooks.useArray(initialValue: {T} | nil) → HookCreator<UseArray<T>>

Types

interface UseArray<T> {
array: {T}
set: (valueOrCallback: T | (array: T) → T) → void
push: (...elements: T) → void
filter: (callback: (
element: T,
index: number
) → boolean) → void
update: (
index: number,
element: T
) → void
remove: (index: number) → void
clear: () → void
}

Lets you manipulate an array data structure without ever needing extra utilities.

local function HookedComponent(props, hooks)
        local text = hooks.useValue()
        local list = useArray({})(hooks)

        return Roact.createFragment({
                Button = Roact.createElement("TextButton", {
                        -- ...
                        Text = "Add",
                        [Roact.Event.MouseButton1Click] = function(rbx)
                                if text.value then
                                        list.push(text.value)
                                end
                                text.value = nil
                        end
                }),
                TextBox = Roact.createElement("TextBox", {
                        -- ...
                        Text = "",
                        [Roact.Change.Text] = function(rbx)
                                text.value = rbx.Text
                        end
                }),
                Display = Roact.createElement("Frame", {
                        -- ...
                }, {
                        Layout = Roact.createElement("UIListLayout", {
                                -- ...
                        }),
                        Roact.createFragment(list.array)
                })
        })
end

useAsync

promise
Hooks.useAsync(asyncCallback: () → Promise<T>) → HookCreator<UseAsync<T>>

Types

interface UseAsync<T> {
isLoading: boolean
isCancelled: boolean
error: T | nil
result: T | nil
}

Handles async operations and prevents race conditions.

local function fetchData()
        return Promise.new(function()
                return httpRequest("http://url...")
        end)
end

local function HookedComponent(props, hooks)
        local async = useAsync(fetchData)(hooks)

        return Roact.createFragment({
                Loading = async.isLoading and Roact.createElement(...),
                Error = async.error and Roact.createElement(...),
                Result = async.result and Roact.createElement(...)
        })
end

useCounter

Hooks.useCounter(initialValue: number | nil) → HookCreator<UseCounter>

Types

type UseCounter = (
number,
() → void,
() → void,
() → void
)

State hook that tracks a numeric value. If no initial value is passed, it will default to 0.

tip

Counters can be increased/decreased by amount if you pass a number to it's function.

local function HookedComponent(props, hooks)
        local count, increment, decrement, reset = useCounter()(hooks)

        return Roact.createFragment({
                Counter = Roact.createElement(MyCounter, {
                        Text = tostring(count)
                }),
                Inc = Roact.createElement(Button, {
                        OnClick = function()
                                increment()
                        end
                }),
                Dec = Roact.createElement(Button, {
                        OnClick = function()
                                decrement()
                        end
                }),
                Reset = Roact.createElement(Button, {
                        OnClick = function()
                                reset()
                        end
                }),
        })
end

useDebounce

promise
Hooks.useDebounce(
time: number,
callback: () → void,
dependencies: {any}
) → HookCreator<(
() → boolean,
() → void
)>

Hook that delays invoking a function until after wait seconds have elapsed since the last time the debounced function was invoked.

The third argument is the array of values that the debounce depends on, in the same manner as useEffect. The debounce timeout will start when one of the values changes.

tip

You can reach the same result using the hook below.

local function HookedComponent(props, hooks)
        local text, setText = hooks.useState("")
        local debouncedText, setDebouncedText = hooks.useState(text)

        -- Will change debouncedText and render after 1 second of inactivity
        useDebounce(1, function()
                setDebouncedText(text)
        end, { text })(hooks)

        return Roact.createFragment({
                Label = Roact.createElement(Label, {
                        Text = debouncedText
                }),
                Box = Roact.createElement("TextBox", {
                        -- ...,
                        [Roact.Change.Text] = function(rbx)
                                setText(rbx.Text)
                        end
                }),
        })
end

useDebouncedText

promise
Hooks.useDebouncedText(
time: number,
text: string
) → HookCreator<string>

A shortcut for using useDebounce with a string.

local function HookedComponent(props, hooks)
        local text, setText = hooks.useState("")
        local debouncedText = useDebouncedText(1, text)(hooks)

        return Roact.createFragment({
                Label = Roact.createElement(Label, {
                        Text = debouncedText
                }),
                Box = Roact.createElement("TextBox", {
                        -- ...,
                        [Roact.Change.Text] = function(rbx)
                                setText(rbx.Text)
                        end
                }),
        })
end

useDispatch

roact-roduxrodux
Hooks.useDispatch(hooks: RoactHooks) → () → void

Returns a function that executes the dispatch method of the store. You may use it to dispatch actions as needed.

local function Counter(props, hooks)
        local dispatch = useDispatch(hooks)

        return Roact.createFragment({
                Label = Roact.createElement("TextLabel", {
                        Text = props.value
                }),
                Increment = Roact.createElement(Button, {
                        OnClick = function()
                                dispatch({ type = "increment" })
                        end
                })
        })
end

useFlipper

flipper
Hooks.useFlipper(motor: FlipperMotor) → HookCreator<UseFlipper>

Types

type UseFlipper = (
RoactBinding<number>,
FlipperMotor
)

Helper hook that takes a flipper motor, connects it to a binding and returns both.

useForceUpdate

Hooks.useForceUpdate(hooks: RoactHooks) → () → void

Returns a callback that once called, will cause the component to re-render.

useLatest

Hooks.useLatest(value: T) → HookCreator<{value: T}>

Hook that can be used to return the latest state.

tip

This is useful to get access to the latest version of a value, instead of getting the version from the time an asynchronous callback was created, for example.

local function Demo(props, hooks)
        local count, increment = useCounter()(hooks)
        local latestCount = useLatest(count)(hooks)

        useTimeout(5, function()
                print(("Latest count is: %s"):format(latestCount.value))
        end)(hooks)

        return Roact.createFragment({
                Label = Roact.createElement(Label, {
                        Text = tostring(count)
                }),
                Button = Roact.createElement(Button, {
                        OnClick = function()
                                increment()
                        end
                })
        })
end

useMaid

maid
Hooks.useMaid(
maid: Maid,
dependencies: {any}
) → HookCreator<void>

Will clear the maid after one of its dependencies change.

TODO EXAMPLE

usePortal

roact
Hooks.usePortal(options: PortalOptions) → HookCreator<UsePortal>

Types

interface PortalOptions {
Target: Instance
DefaultShow: boolean | nil
DisplayName: string | nil
DisplayOrder: number | nil
IgnoreGuiInset: boolean | nil
OnShow: (() → void) | nil
OnHide: (() → void) | nil
OnClickOutside: ((hide: () → void) → void) | nil
}

interface UsePortal {
Portal: Roact.FunctionComponent
isShow: boolean
show: () → void
hide: () → void
toggle: () → void
}

This helps you render children into an element that exists outside the hierarchy of the parent component.

TODO EXAMPLE

usePrevious

Hooks.usePrevious(state: S) → HookCreator<S>

Simply returns the previous state.

useQueue

Hooks.useQueue(initialValue: {T}) → HookCreator<UseQueue<T>>

Types

interface UseQueue<T> {
add: (element: T) → void
remove: () → void
first: T | nil
last: T | nil
size: number
}

State hook that implements a simple FIFO queue.

useReactiveState

Hooks.useReactiveState(initialState: T) → HookCreator<T>

Types

type HookCreator<T> = (hooks: RoactHooks) → T

Creates a state object that can be changed whenever a new value is assigned to a key.

useRendersSpy

Hooks.useRendersSpy(hooks: RoactHooks) → number

Returns the amount of renders the component has since its mount.

useSelector

roact-roduxrodux
Hooks.useSelector(
selector: (state: S) → R,
equalityFn: ((
a: any,
b: any
) → boolean) | nil
) → HookCreator<R>

Allows you to extract data from the store state, using a selector function.

warning

Selectors should be pure since they are potentially executed multiple times and at arbitrary points in time.

useStore

roact-roduxrodux
Hooks.useStore(hooks: RoactHooks) → Store

Returns a reference to the same store that was passed in to the StoreProvider component.

caution

This should not be used frequently. If you just want to retrieve data from the store, prefer useSelector instead.

useTimeout

promise
Hooks.useTimeout(
time: number,
callback: () → void,
onCancel: ((timeLeft: number) → void) | nil
) → HookCreator<UseTimeout>

Types

interface UseTimeout {
cancel: () → void
reset: () → void
}

Re-renders the component after a specified number of seconds. Provides handles to cancel and/or reset the timeout.

info

This is a one time call. Once the timeout is finished, you cannot use it again. If you are looking into something that can change accordingly to its dependencies, check useDebounce.

local function HookedComponent(props, hooks)
        local text, setText = useState("")
        local timeout = useTimeout(3, function()
                setText("This took 3 seconds!")
        end)(hooks)

        return Roact.createElement("TextLabel", {
                -- ...
                Text = text,
        })
end

useToggle

Hooks.useToggle(initialValue: boolean) → HookCreator<UseToggle>

Types

type UseToggle = (
boolean,
(value: boolean | nil) → void
)

State hook that tracks value of a boolean.

useTween

Hooks.useTween(tweenInfo: TweenInfo) → HookCreator<(
RoactBinding<number>,
)>

Types

interface UseTween {
play: () → void
pause: () → void
cancel: () → void
onCompleted: (callback: (playbackState: Enum.PlaybackState) → void) → void
}

Takes a TweenInfo class and returns a binding and an object to manage the tweening.

TODO EXAMPLE

useUndo

Hooks.useUndo(initialPresent: T) → HookCreator<(
UseUndoState<T>,
UseUndo<T>
)>

Types

interface UseUndo<T> {
set: (newPresent: T) → void
reset: (newPresent: T) → void
undo: () → void
redo: () → void
canUndo: boolean
canRedo: boolean
}

interface UseUndoState<T> {
past: {T}
present: T
future: {T}
}

Stores defined amount of previous state values and provides handles to travel through them.

TODO EXAMPLE

useUpdateEffect

Hooks.useUpdateEffect(
callback: () → (() → void) | void,
dependencies: {any} | nil
) → HookCreator<void>

Does the exactly same thing useEffect do, but ignores the first render.

Show raw api
{
    "functions": [
        {
            "name": "useArray",
            "desc": "Lets you manipulate an array data structure without ever needing extra utilities.\n\n```lua\nlocal function HookedComponent(props, hooks)\n        local text = hooks.useValue()\n        local list = useArray({})(hooks)\n\n        return Roact.createFragment({\n                Button = Roact.createElement(\"TextButton\", {\n                        -- ...\n                        Text = \"Add\",\n                        [Roact.Event.MouseButton1Click] = function(rbx)\n                                if text.value then\n                                        list.push(text.value)\n                                end\n                                text.value = nil\n                        end\n                }),\n                TextBox = Roact.createElement(\"TextBox\", {\n                        -- ...\n                        Text = \"\",\n                        [Roact.Change.Text] = function(rbx)\n                                text.value = rbx.Text\n                        end\n                }),\n                Display = Roact.createElement(\"Frame\", {\n                        -- ...\n                }, {\n                        Layout = Roact.createElement(\"UIListLayout\", {\n                                -- ...\n                        }),\n                        Roact.createFragment(list.array)\n                })\n        })\nend\n```",
            "params": [
                {
                    "name": "initialValue",
                    "desc": "",
                    "lua_type": "{T} | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseArray<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 46,
                "path": "src/Hooks/useArray.lua"
            }
        },
        {
            "name": "useAsync",
            "desc": "Handles async operations and prevents race conditions.\n\n```lua\nlocal function fetchData()\n        return Promise.new(function()\n                return httpRequest(\"http://url...\")\n        end)\nend\n\nlocal function HookedComponent(props, hooks)\n        local async = useAsync(fetchData)(hooks)\n\n        return Roact.createFragment({\n                Loading = async.isLoading and Roact.createElement(...),\n                Error = async.error and Roact.createElement(...),\n                Result = async.result and Roact.createElement(...)\n        })\nend\n```",
            "params": [
                {
                    "name": "asyncCallback",
                    "desc": "",
                    "lua_type": "() -> Promise<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseAsync<T>>"
                }
            ],
            "function_type": "static",
            "tags": [
                "promise"
            ],
            "source": {
                "line": 30,
                "path": "src/Hooks/useAsync.lua"
            }
        },
        {
            "name": "useCounter",
            "desc": "State hook that tracks a numeric value.\nIf no initial value is passed, it will default to 0.\n\n:::tip\nCounters can be increased/decreased by amount if you pass a number to it's function.\n:::\n\n```lua\nlocal function HookedComponent(props, hooks)\n        local count, increment, decrement, reset = useCounter()(hooks)\n\n        return Roact.createFragment({\n                Counter = Roact.createElement(MyCounter, {\n                        Text = tostring(count)\n                }),\n                Inc = Roact.createElement(Button, {\n                        OnClick = function()\n                                increment()\n                        end\n                }),\n                Dec = Roact.createElement(Button, {\n                        OnClick = function()\n                                decrement()\n                        end\n                }),\n                Reset = Roact.createElement(Button, {\n                        OnClick = function()\n                                reset()\n                        end\n                }),\n        })\nend\n```",
            "params": [
                {
                    "name": "initialValue",
                    "desc": "",
                    "lua_type": "number | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseCounter>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 42,
                "path": "src/Hooks/useCounter.lua"
            }
        },
        {
            "name": "useDebounce",
            "desc": "Hook that delays invoking a function until after wait seconds have elapsed since the last time the debounced function was invoked.\n\nThe third argument is the array of values that the debounce depends on, in the same manner as `useEffect`.\nThe debounce timeout will start when one of the values changes.\n\n:::tip\nYou can reach the same result using the hook [below](#useDebouncedText  ).\n:::\n\n```lua\nlocal function HookedComponent(props, hooks)\n        local text, setText = hooks.useState(\"\")\n        local debouncedText, setDebouncedText = hooks.useState(text)\n\n        -- Will change debouncedText and render after 1 second of inactivity\n        useDebounce(1, function()\n                setDebouncedText(text)\n        end, { text })(hooks)\n\n        return Roact.createFragment({\n                Label = Roact.createElement(Label, {\n                        Text = debouncedText\n                }),\n                Box = Roact.createElement(\"TextBox\", {\n                        -- ...,\n                        [Roact.Change.Text] = function(rbx)\n                                setText(rbx.Text)\n                        end\n                }),\n        })\nend\n```",
            "params": [
                {
                    "name": "time",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "() -> void"
                },
                {
                    "name": "dependencies",
                    "desc": "",
                    "lua_type": "{any}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<(() -> boolean, () -> void)>"
                }
            ],
            "function_type": "static",
            "tags": [
                "promise"
            ],
            "source": {
                "line": 46,
                "path": "src/Hooks/useDebounce.lua"
            }
        },
        {
            "name": "useDebouncedText",
            "desc": "A shortcut for using [useDebounce](#useDebounce) with a string.\n\n```lua\nlocal function HookedComponent(props, hooks)\n        local text, setText = hooks.useState(\"\")\n        local debouncedText = useDebouncedText(1, text)(hooks)\n\n        return Roact.createFragment({\n                Label = Roact.createElement(Label, {\n                        Text = debouncedText\n                }),\n                Box = Roact.createElement(\"TextBox\", {\n                        -- ...,\n                        [Roact.Change.Text] = function(rbx)\n                                setText(rbx.Text)\n                        end\n                }),\n        })\nend\n```",
            "params": [
                {
                    "name": "time",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<string>"
                }
            ],
            "function_type": "static",
            "tags": [
                "promise"
            ],
            "source": {
                "line": 33,
                "path": "src/Hooks/useDebouncedText.lua"
            }
        },
        {
            "name": "useDispatch",
            "desc": "Returns a function that executes the `dispatch` method of the store.\nYou may use it to dispatch actions as needed.\n\n```lua\nlocal function Counter(props, hooks)\n        local dispatch = useDispatch(hooks)\n\n        return Roact.createFragment({\n                Label = Roact.createElement(\"TextLabel\", {\n                        Text = props.value\n                }),\n                Increment = Roact.createElement(Button, {\n                        OnClick = function()\n                                dispatch({ type = \"increment\" })\n                        end\n                })\n        })\nend\n```",
            "params": [
                {
                    "name": "hooks",
                    "desc": "",
                    "lua_type": "RoactHooks"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> void"
                }
            ],
            "function_type": "static",
            "tags": [
                "roact-rodux",
                "rodux"
            ],
            "source": {
                "line": 32,
                "path": "src/Hooks/useDispatch.lua"
            }
        },
        {
            "name": "useFlipper",
            "desc": "Helper hook that takes a flipper motor, connects it to a binding and returns both.",
            "params": [
                {
                    "name": "motor",
                    "desc": "",
                    "lua_type": "FlipperMotor"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseFlipper>"
                }
            ],
            "function_type": "static",
            "tags": [
                "flipper"
            ],
            "source": {
                "line": 13,
                "path": "src/Hooks/useFlipper.lua"
            }
        },
        {
            "name": "useForceUpdate",
            "desc": "Returns a callback that once called, will cause the component to re-render.",
            "params": [
                {
                    "name": "hooks",
                    "desc": "",
                    "lua_type": "RoactHooks"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> void"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 10,
                "path": "src/Hooks/useForceUpdate.lua"
            }
        },
        {
            "name": "useLatest",
            "desc": "Hook that can be used to return the latest state.\n\n:::tip\nThis is useful to get access to the latest version of a value, instead of getting the version from the time an asynchronous callback was created, for example.\n:::\n\n```lua\nlocal function Demo(props, hooks)\n        local count, increment = useCounter()(hooks)\n        local latestCount = useLatest(count)(hooks)\n\n        useTimeout(5, function()\n                print((\"Latest count is: %s\"):format(latestCount.value))\n        end)(hooks)\n\n        return Roact.createFragment({\n                Label = Roact.createElement(Label, {\n                        Text = tostring(count)\n                }),\n                Button = Roact.createElement(Button, {\n                        OnClick = function()\n                                increment()\n                        end\n                })\n        })\nend\n```",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<{ value: T }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 36,
                "path": "src/Hooks/useLatest.lua"
            }
        },
        {
            "name": "useMaid",
            "desc": "Will clear the maid after one of its dependencies change.\n\n> TODO EXAMPLE",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "dependencies",
                    "desc": "",
                    "lua_type": "{any}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<void>"
                }
            ],
            "function_type": "static",
            "tags": [
                "maid"
            ],
            "source": {
                "line": 15,
                "path": "src/Hooks/useMaid.lua"
            }
        },
        {
            "name": "usePortal",
            "desc": "This helps you render children into an element that exists outside the hierarchy of the parent component.\n\n> TODO EXAMPLE",
            "params": [
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "PortalOptions"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UsePortal>"
                }
            ],
            "function_type": "static",
            "tags": [
                "roact"
            ],
            "source": {
                "line": 31,
                "path": "src/Hooks/usePortal.lua"
            }
        },
        {
            "name": "usePrevious",
            "desc": "Simply returns the previous state.",
            "params": [
                {
                    "name": "state",
                    "desc": "",
                    "lua_type": "S"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<S>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 10,
                "path": "src/Hooks/usePrevious.lua"
            }
        },
        {
            "name": "useQueue",
            "desc": "State hook that implements a simple FIFO queue.",
            "params": [
                {
                    "name": "initialValue",
                    "desc": "",
                    "lua_type": "{T}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseQueue<T>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 11,
                "path": "src/Hooks/useQueue.lua"
            }
        },
        {
            "name": "useReactiveState",
            "desc": "Creates a state object that can be changed whenever a new value is assigned to a key.",
            "params": [
                {
                    "name": "initialState",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "src/Hooks/useReactiveState.lua"
            }
        },
        {
            "name": "useRendersSpy",
            "desc": "Returns the amount of renders the component has since its mount.",
            "params": [
                {
                    "name": "hooks",
                    "desc": "",
                    "lua_type": "RoactHooks"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 10,
                "path": "src/Hooks/useRendersSpy.lua"
            }
        },
        {
            "name": "useSelector",
            "desc": "Allows you to extract data from the store state, using a selector function.\n\n:::warning\nSelectors should be [pure](https://en.wikipedia.org/wiki/Pure_function) since they are potentially executed multiple times and at arbitrary points in time.\n:::",
            "params": [
                {
                    "name": "selector",
                    "desc": "",
                    "lua_type": "(state: S) -> R"
                },
                {
                    "name": "equalityFn",
                    "desc": "",
                    "lua_type": "((a: any, b: any) -> boolean) | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<R>"
                }
            ],
            "function_type": "static",
            "tags": [
                "roact-rodux",
                "rodux"
            ],
            "source": {
                "line": 26,
                "path": "src/Hooks/useSelector.lua"
            }
        },
        {
            "name": "useStore",
            "desc": "Returns a reference to the same store that was passed in to the `StoreProvider` component.\n\n:::caution\nThis **should not** be used frequently.\nIf you just want to retrieve data from the store, prefer [useSelector](#useSelector) instead.\n:::",
            "params": [
                {
                    "name": "hooks",
                    "desc": "",
                    "lua_type": "RoactHooks"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Store"
                }
            ],
            "function_type": "static",
            "tags": [
                "roact-rodux",
                "rodux"
            ],
            "source": {
                "line": 32,
                "path": "src/Hooks/useStore.lua"
            }
        },
        {
            "name": "useTimeout",
            "desc": "Re-renders the component after a specified number of seconds.\nProvides handles to cancel and/or reset the timeout.\n\n:::info\nThis is a one time call. Once the timeout is finished, you cannot use it again.\nIf you are looking into something that can change accordingly to its dependencies, check [useDebounce](#useDebounce).\n:::\n\n```lua\nlocal function HookedComponent(props, hooks)\n        local text, setText = useState(\"\")\n        local timeout = useTimeout(3, function()\n                setText(\"This took 3 seconds!\")\n        end)(hooks)\n\n        return Roact.createElement(\"TextLabel\", {\n                -- ...\n                Text = text,\n        })\nend\n```",
            "params": [
                {
                    "name": "time",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "() -> void"
                },
                {
                    "name": "onCancel",
                    "desc": "",
                    "lua_type": "((timeLeft: number) -> void) | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseTimeout>"
                }
            ],
            "function_type": "static",
            "tags": [
                "promise"
            ],
            "source": {
                "line": 36,
                "path": "src/Hooks/useTimeout.lua"
            }
        },
        {
            "name": "useToggle",
            "desc": "State hook that tracks value of a boolean.",
            "params": [
                {
                    "name": "initialValue",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<UseToggle>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 10,
                "path": "src/Hooks/useToggle.lua"
            }
        },
        {
            "name": "useTween",
            "desc": "Takes a TweenInfo class and returns a binding and an object to manage the tweening.\n\n> TODO EXAMPLE",
            "params": [
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<(RoactBinding<number>, UseTween)>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "src/Hooks/useTween.lua"
            }
        },
        {
            "name": "useUndo",
            "desc": "Stores defined amount of previous state values and provides handles to travel through them.\n\n> TODO EXAMPLE",
            "params": [
                {
                    "name": "initialPresent",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<(UseUndoState<T>, UseUndo<T>)>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 100,
                "path": "src/Hooks/useUndo.lua"
            }
        },
        {
            "name": "useUpdateEffect",
            "desc": "Does the exactly same thing `useEffect` do, but ignores the first render.",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "() -> (() -> void) | void"
                },
                {
                    "name": "dependencies",
                    "desc": "",
                    "lua_type": "{any} | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HookCreator<void>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 11,
                "path": "src/Hooks/useUpdateEffect.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "HookCreator<T>",
            "desc": "",
            "lua_type": "(hooks: RoactHooks) -> T",
            "source": {
                "line": 7,
                "path": "src/init.lua"
            }
        },
        {
            "name": "PortalOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Target",
                    "lua_type": "Instance",
                    "desc": ""
                },
                {
                    "name": "DefaultShow",
                    "lua_type": "boolean | nil",
                    "desc": ""
                },
                {
                    "name": "DisplayName",
                    "lua_type": "string | nil",
                    "desc": ""
                },
                {
                    "name": "DisplayOrder",
                    "lua_type": "number | nil",
                    "desc": ""
                },
                {
                    "name": "IgnoreGuiInset",
                    "lua_type": "boolean | nil",
                    "desc": ""
                },
                {
                    "name": "OnShow",
                    "lua_type": "(() -> void) | nil",
                    "desc": ""
                },
                {
                    "name": "OnHide",
                    "lua_type": "(() -> void) | nil",
                    "desc": ""
                },
                {
                    "name": "OnClickOutside",
                    "lua_type": "((hide: () -> void) -> void) | nil",
                    "desc": ""
                }
            ],
            "source": {
                "line": 18,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseArray<T>",
            "desc": "",
            "fields": [
                {
                    "name": "array",
                    "lua_type": "{T}",
                    "desc": ""
                },
                {
                    "name": "set",
                    "lua_type": "(valueOrCallback: T | (array: T) -> T) -> void",
                    "desc": ""
                },
                {
                    "name": "push",
                    "lua_type": "(...elements: T) -> void",
                    "desc": ""
                },
                {
                    "name": "filter",
                    "lua_type": "(callback: (element: T, index: number) -> boolean) -> void",
                    "desc": ""
                },
                {
                    "name": "update",
                    "lua_type": "(index: number, element: T) -> void",
                    "desc": ""
                },
                {
                    "name": "remove",
                    "lua_type": "(index: number) -> void",
                    "desc": ""
                },
                {
                    "name": "clear",
                    "lua_type": "() -> void",
                    "desc": ""
                }
            ],
            "source": {
                "line": 28,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseAsync<T>",
            "desc": "",
            "fields": [
                {
                    "name": "isLoading",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "isCancelled",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "error",
                    "lua_type": "T | nil",
                    "desc": ""
                },
                {
                    "name": "result",
                    "lua_type": "T | nil",
                    "desc": ""
                }
            ],
            "source": {
                "line": 35,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseCounter",
            "desc": "",
            "lua_type": "(number, () -> void, () -> void, () -> void)",
            "source": {
                "line": 38,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseFlipper",
            "desc": "",
            "lua_type": "(RoactBinding<number>, FlipperMotor)",
            "source": {
                "line": 41,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UsePortal",
            "desc": "",
            "fields": [
                {
                    "name": "Portal",
                    "lua_type": "Roact.FunctionComponent",
                    "desc": ""
                },
                {
                    "name": "isShow",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "show",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "hide",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "toggle",
                    "lua_type": "() -> void",
                    "desc": ""
                }
            ],
            "source": {
                "line": 49,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseQueue<T>",
            "desc": "",
            "fields": [
                {
                    "name": "add",
                    "lua_type": "(element: T) -> void",
                    "desc": ""
                },
                {
                    "name": "remove",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "first",
                    "lua_type": "T | nil",
                    "desc": ""
                },
                {
                    "name": "last",
                    "lua_type": "T | nil",
                    "desc": ""
                },
                {
                    "name": "size",
                    "lua_type": "number",
                    "desc": ""
                }
            ],
            "source": {
                "line": 57,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseTimeout",
            "desc": "",
            "fields": [
                {
                    "name": "cancel",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "reset",
                    "lua_type": "() -> void",
                    "desc": ""
                }
            ],
            "source": {
                "line": 62,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseToggle",
            "desc": "",
            "lua_type": "(boolean, (value: boolean | nil) -> void)",
            "source": {
                "line": 65,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseTween",
            "desc": "",
            "fields": [
                {
                    "name": "play",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "pause",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "cancel",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "onCompleted",
                    "lua_type": "(callback: (playbackState: Enum.PlaybackState) -> void) -> void",
                    "desc": ""
                }
            ],
            "source": {
                "line": 72,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseUndo<T>",
            "desc": "",
            "fields": [
                {
                    "name": "set",
                    "lua_type": "(newPresent: T) -> void",
                    "desc": ""
                },
                {
                    "name": "reset",
                    "lua_type": "(newPresent: T) -> void",
                    "desc": ""
                },
                {
                    "name": "undo",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "redo",
                    "lua_type": "() -> void",
                    "desc": ""
                },
                {
                    "name": "canUndo",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "canRedo",
                    "lua_type": "boolean",
                    "desc": ""
                }
            ],
            "source": {
                "line": 81,
                "path": "src/init.lua"
            }
        },
        {
            "name": "UseUndoState<T>",
            "desc": "",
            "fields": [
                {
                    "name": "past",
                    "lua_type": "{T}",
                    "desc": ""
                },
                {
                    "name": "present",
                    "lua_type": "T",
                    "desc": ""
                },
                {
                    "name": "future",
                    "lua_type": "{T}",
                    "desc": ""
                }
            ],
            "source": {
                "line": 87,
                "path": "src/init.lua"
            }
        }
    ],
    "name": "Hooks",
    "desc": "",
    "source": {
        "line": 4,
        "path": "src/init.lua"
    }
}