How to add custom reactjs components (belle) to my rails app -


i want add custom react components (belle) rails app. i'm using react-rails 1.0.0 view layer write coffeescript.

first of new reactjs , steps site bring commonjs asset pipeline moves browserify-rails installed browserify on github page , arkency blog. run npm install --save belle in console, added application.js :

var belle = require('belle'); textinput = belle.textinput; 

at end added main component simple component belle

'<textinput defaultvalue={update here , see how input grows} />'

below sites.js.coffee file:

@sites = react.createclass   getinitialstate: ->     sites: @props.data   getdefaultstate: ->     sites: []   render: ->     react.dom.div       classname: 'sites_wrapper'       '<textinput defaultvalue={update here , see how input grows} />'       site in @state.sites                react.dom.div           classname: 'col-md-4 text-center'           react.createelement site, key: site.id, site: site, articles: site.articles 

the result that, have blank, white page. way - add custom component rails app, good? or better way this? if first question, answer 'yes', make wrong?

thanks help.

i'm can't rails part, noticed in front of textinput var declaration missing. mistake in getting started part of belle readme.

correct version:

var textinput = belle.textinput;


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -