GithubHelp home page GithubHelp logo

Comments (4)

jtmalinowski avatar jtmalinowski commented on July 27, 2024

Hi,
Could you provide any sample code to show what is not working for you?

This works for me:

<%= react_component('TasksComponent', {:name => 'John', :tasks => Task.all}, {:prerender => true}) %>
{div} = React.DOM

@TasksComponent = React.createClass
  getInitialState: ->
    return null

  render: ->
    div null, [
      div(null, @props.tasks.map((t) -> t.name))
    ]

Sorry for coffee-script.

from react-rails.

jorge-marques avatar jorge-marques commented on July 27, 2024

Passing a ruby hash does indeed work. What I'd like to is to pass a reference to a javascript object, to be evaluated at runtime in the browser.

Also is the possible to pass another component as a prop with this method?

from react-rails.

meleyal avatar meleyal commented on July 27, 2024

AFAIK this is not possible as the helper is evaluated on the server, while the JS object is only available on the client.

I guess it could be implemented in react_ujs as some kind of promise that resolves when the component actually mounts.

from react-rails.

jtmalinowski avatar jtmalinowski commented on July 27, 2024

I cannot see any interest in this thread right now, so closing, but if anyone stumbles upon this - I'll be happy to reopen and rethink!

from react-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.