GithubHelp home page GithubHelp logo

Comments (6)

samnang avatar samnang commented on June 24, 2024

@justin808 For indentation in heredoc, we could use http://api.rubyonrails.org/classes/String.html#method-i-strip_heredoc to remove white spaces from beginning.

from react_on_rails.

justin808 avatar justin808 commented on June 24, 2024

@samnang We originally did it that way, but it's super hard as well for changing the indentation. The code is also going to be slightly faster not using it. On a somewhat related note, we should maybe put some of the code for the client side into a file included in application.js.

Take a look at: https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/spec/sample_generated_js/client-generated.js

I think we only need a few parameters to a client side method call:

  1. name of globally exposed variable (property to be put on window): 'helloWorldES5Data0'
  2. name of id for element: 'HelloWorldES5-react-component-0'
  3. name of component: 'HelloWorldES5'
  4. trace: boolean
  5. expect turbolinks: boolean

from react_on_rails.

szyablitsky avatar szyablitsky commented on June 24, 2024

I think that moving javascript into .js file which should be included in Rails' application.js is a good idea. If we need to add some runtime logic, than we can change extension to .js.erb and do some preprocessing for javascript code. And even cache it all or partially for performance gain.

from react_on_rails.

justin808 avatar justin808 commented on June 24, 2024

@szyablitsky Let me know if you'd like to do this. Or anybody else does, please let me know.

from react_on_rails.

justin808 avatar justin808 commented on June 24, 2024

@samnang and I made amazing progress from this today.

from react_on_rails.

justin808 avatar justin808 commented on June 24, 2024

Fixed by #44.

from react_on_rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.