ember-react icon indicating copy to clipboard operation
ember-react copied to clipboard

props not being passed through to react component

Open cjroebuck opened this issue 9 years ago • 4 comments

Using the react helper like in the readme, e.g. {{react componentName='mycomponent' foo=bar }} this.props.foo inside the react component is not set. Not working for Ember 1.13+.

cjroebuck avatar Jul 23 '15 15:07 cjroebuck

Are you able to get it working at all with Ember 1.13+? Or just having issues with props. I can't seem to get it working at all due to js errors being thrown like: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined

ggrillone avatar Sep 30 '15 16:09 ggrillone

It's highly possible some of the Ember internal's this depends upon have changed. Unfortunately I don't have the bandwidth to dig into this right now.

ghempton avatar Sep 30 '15 17:09 ghempton

Digging into it a big, what I've found so far:

  • The type paramater in the autoGenerateWrapperClass function (React) is undefined, and it's trying to call toUpperCase() on type, which is why the error is occuring
  • Going a little deeper, looking into the ember-react code, specifically in the ReactComponent renderReact() function it is creating a variable reactClass, which to my knowledge so far is responsible for that type param that React uses. And inside of the renderReact function the reactClass variable is undefined

I'll post anything else if I uncover more

ggrillone avatar Sep 30 '15 18:09 ggrillone

I ended up getting it working by not using jsx and opting for vanilla javascript in the react component.

Testing passing in props worked as well

ggrillone avatar Oct 06 '15 14:10 ggrillone