All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- useContext now provides the default value of the provider, instead of erroring, when there is nothing to source from.
- Added Luau types to Hooks API (#36)
- Fixed
useMemo
not working correctly with nil dependencies (#35)
- Provide Roact instance in hooks argument (#28)
- Fix useContext for uninitialized and/or changing contexts (#26)
useMemo
now computes a new value every render if no array is provided (#29)- Fixed
useEffect
not running when a dependency changes to nil (#32)
useEffect
now call its unmount function when its dependencies change, just like React hooks.useState
will now cache default values, meaninguseState(math.random)
will no longer give a new default value every time.useState
with a default parameter will now call the function without parameters, rather than with 1 nil parameter. This caused problems withuseState(math.random)
, asmath.random()
is valid, butmath.random(nil)
is not.
useState
will now properly pass in default values when giving a callback to the set function, rather than passing in nil.
- Added validateProps component API option for hooked components.
validateProps(props) -> (false, message: string) | true
- Added componentType component API option for hooked components.
componentType?: string
. Accepted strings are "Component" and "PureComponent".
- Current state is now provided to callback function when using
useState(function)
- useMemo now supports tuple return values.
- Fixed hook dependencies not registering updates.
- Added
useState
. - Added
useEffect
. - Added
useContext
. - Added
useValue
. - Added
useMemo
. - Added
useCallback
. - Added
useBinding
. - Added
useReducer
.