Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 2392095

Browse files
committed
Update react-tutorial example
1 parent 32f891e commit 2392095

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

example/react-tutorial/example.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def self.set_interval(delay, &block)
1111

1212
class Comment
1313
include React::Component
14-
14+
1515
def render
1616
converter = Native(`new Showdown.converter()`)
1717
raw_markup = converter.makeHtml(params[:children].to_s)
@@ -20,7 +20,7 @@ def render
2020
span(dangerously_set_inner_HTML: {__html: raw_markup}.to_n)
2121
end
2222
end
23-
end
23+
end
2424

2525
class CommentList
2626
include React::Component
@@ -43,7 +43,7 @@ def render
4343
input type: "text", placeholder: "Say something...", ref: "text"
4444
input type: "submit", value: "Post"
4545
end
46-
46+
4747
f.on(:submit) do |event|
4848
event.prevent_default
4949
author = self.refs.author.getDOMNode().value.strip
@@ -70,16 +70,16 @@ def load_comments_from_server
7070
end
7171
end
7272
end
73-
73+
7474
def start_polling
75-
Window.set_interval(params[:pollInterval]) { load_comments_from_server }
75+
Window.set_interval(params[:poll_interval]) { load_comments_from_server }
7676
end
7777

7878
def handle_comment_submit(comment)
7979
comments = self.data
8080
comments.push(comment)
8181
self.data = comments
82-
82+
8383
HTTP.post(params[:url], payload: comment) do |response|
8484
if response.ok?
8585
self.data = JSON.parse(response.body)
@@ -99,6 +99,6 @@ def render
9999
end
100100

101101

102-
Document.ready? do
102+
Document.ready? do
103103
React.render React.create_element(CommentBox, url: "comments.json", poll_interval: 2000), Element.find('#content').get(0)
104-
end
104+
end

lib/react/top_level.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module React
2020
muted name noValidate open pattern placeholder poster preload radioGroup
2121
readOnly rel required role rows rowSpan sandbox scope scrolling seamless
2222
selected shape size sizes span spellCheck src srcDoc srcSet start step style
23-
tabIndex target title type useMap value width wmode dangerously_set_inner_HTML)
23+
tabIndex target title type useMap value width wmode dangerouslySetInnerHTML)
2424

2525
def self.create_element(type, properties = {}, &block)
2626
React::API.create_element(type, properties, &block)

0 commit comments

Comments
 (0)