rad_hooks 0.0.1 rad_hooks: ^0.0.1 copied to clipboard
A set of extensible and powerful hooks for using in your Rad applications.
Rad Hooks #
A set of commonly used React hooks for using in your Rad applications.
Basic Usage #
Widget someReUsableWidget() => HookScope(() {
// create a state variable
var state = useState(1);
return Division(
innerText: 'You clicked me ${state.value} times!',
onClick: (e) => state.value++, // <- update state(causes re-render)
);
});
void main() {
runApp(
app: someReUsableWidget(),
appTargetId: 'output',
);
}
This package also serves as an example that show cases flexibility and power of hooks APIs in Rad. If you feel like missing a hook, you can just create it and hook it in your application. We recommend you to look into implementation of hooks in this package for getting an idea on how to create your own hooks which then can be used directly in your Rad applications.