-
-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boilerplate for reason hello world component
- bsconfig - bsb make and clean commands in build - ReasonHelloWorld.re component - added component to client registration file RAILS - add route - add hyperlink on main page - view file
- Loading branch information
Leora Juster
committed
May 9, 2019
1 parent
5a978a8
commit 4d8f440
Showing
11 changed files
with
170 additions
and
8 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
spec/dummy/app/views/pages/client_side_reason_hello_world.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<%= react_component("HelloWorldReason", props: @app_props_server_render, prerender: false, trace: true, id: "HelloWorld-react-component-0") %> | ||
<hr/> | ||
|
||
<h1>React Rails Client Side Only Rendering</h1> | ||
<p> | ||
This example demonstrates client side only rendering.<br/><br/> | ||
The source HTML of this page will only show a DIV with an ID matching HelloWorld.<br/> | ||
<pre> | ||
<%= "<div id=\"HelloWorld-reason-react-component-0\"></div>" %> | ||
</pre><br/><br/> | ||
Compare this to the HTML created for server rendering.<br/> | ||
</p> | ||
|
||
<hr/> | ||
<h2>Setup</h2> | ||
<ol> | ||
<li> | ||
Create component source: spec/dummy/client/app/components/HelloWorldReason.bs.js | ||
</li> | ||
<li> | ||
Expose the HelloWorld Component: spec/dummy/client/app/startup/clientRegistration.jsx | ||
<br/> | ||
<pre> | ||
import HelloWorldReason from '../components/HelloWorldReason'; | ||
import ReactOnRails from 'react-on-rails'; | ||
ReactOnRails.register({ HelloWorldReason }); | ||
</pre> | ||
</li> | ||
<li> | ||
Place the component on the view: spec/dummy/app/views/pages/client_side_reason_hello_world.html.erb | ||
<br/> | ||
<pre> | ||
<%%= react_component("HelloWorldReason", props: @app_props_server_render, prerender: false, trace: true, id: "HelloWorld-reason-react-component-0") %> | ||
</pre> | ||
</li> | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
####{BSB GENERATED: NO EDIT | ||
FLG -ppx '/Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-platform/lib/reactjs_jsx_ppx_2.exe' | ||
FLG -ppx /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-platform/lib/bsppx.exe | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-platform/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-platform/lib/ocaml | ||
FLG -nostdlib -color always | ||
FLG -w -30-40+6+7+27+32..39+44+45+101-45 | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/reason-react/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/reason-react/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/re-classnames/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/re-classnames/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/re-debouncer/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/re-debouncer/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/@glennsl/bs-json/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/@glennsl/bs-json/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-log/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-log/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-fetch/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-fetch/lib/ocaml | ||
S /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-date-fns/lib/ocaml | ||
B /Users/leorajuster/Desktop/repos/react_on_rails/spec/dummy/client/node_modules/bs-date-fns/lib/ocaml | ||
S app/components | ||
B lib/bs/app/components | ||
####BSB GENERATED: NO EDIT} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[@bs.module] | ||
let component = ReasonReact.statelessComponent("HelloWorldReason"); | ||
|
||
let make = (~message, _children) => { | ||
...component, | ||
render: _self => | ||
<div className="HelloWorldReason"> | ||
<div className="HelloWorldReason-header"> | ||
<img src=logo className="HelloWorldReason-logo" alt="logo" /> | ||
<h2> {ReasonReact.string(message)} </h2> | ||
</div> | ||
<div className="HelloWorldReason-intro"> <Todo /> </div> | ||
</div>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "hawaii-chee", | ||
"reason": { | ||
"react-jsx": 2 | ||
}, | ||
"sources": { | ||
"dir": "app/components", | ||
"subdirs": true | ||
}, | ||
"package-specs": [ | ||
{ | ||
"module": "commonjs", | ||
"in-source": true | ||
} | ||
], | ||
"suffix": ".bs.js", | ||
"bs-dependencies": [ | ||
"reason-react", | ||
"re-classnames", | ||
"re-debouncer", | ||
"@glennsl/bs-json", | ||
"bs-log", | ||
"bs-fetch", | ||
"bs-date-fns" | ||
], | ||
"refmt": 3, | ||
"warnings": { | ||
"error": "+5", | ||
"number": "-45" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters