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.cr
lucky_react/version.cr

Constant Summary

VERSION = "0.1.0"

Instance Method Summary

Instance Method Detail

def react(class_name : String, tag : String | Nil = "div") #

[View source]
def react(class_name : String, tag : String | Nil = "div", &) #

[View source]
def react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div") #

[View source]
def react(class_name : String, props : NamedTuple | JSON::Any, tag : String | Nil = "div", &) #

[View source]