module LuckyReact
Overview
Include in a Lucky page and call react to render divs with [react-data-class]
and [react-data-props]
attributes set that can be picked up by the
lucky-react
script.
Example
class Home::IndexPage < GuestLayout include LuckyReact
def content react "Wrapper" do # with a block for nesting h1 "Nested Header" end
messages = [
{ id: 1, sender: "me", text: "Hi" },
{ id: 2, sender: "Chatbot", text: "Hi! How can I help?" }
]
react "Chat", { messages: messages } # with props
end end
Defined in:
lucky_react.crlucky_react/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Instance Method Summary
- #react(class_name : String, tag : String | Nil = "div")
- #react(class_name : String, tag : String | Nil = "div", &)
- #react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div")
- #react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div", &)
Instance Method Detail
def react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div")
#
def react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div", &)
#