2.1.1 • Published 5 years ago
widgets-for-react
Licence
ISC
Version
2.1.1
Deps
1
Size
75 kB
Vulns
0
Weekly
111
Widgets for React
The widget library allows developers to quickly develop composable and reusable React components by defining a common interface for passing data across different modules of an application.
Installation
You can install with npm install widgets-for-react or yarn add widgets-for-react.
Basic usage
You can create a hello world widget application as follows:
let hello_world_app =
stateful<string>()(s =>
div<string>({ className:"form-group" })(
label<string>("Type text here", { htmlFor:"main-input", label_position: "before" })(
div<string>({ className:"input-group" })(
string({ id:"main-input", className:"form-control" })(s)
)
)
)
)("Hello world!")
Widgets have a run method which can be invoked in order to embed the widget in a normal React application, as follows:
<div>
{ hello_world_app.run(res =>
console.log("The widget has produced some output data", res)) }
</div>