Yii Framework Forum: How to inject react into a yii project - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to inject react into a yii project Rate Topic: -----

#1 User is offline   Jana 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 15-September 17

Posted 15 September 2017 - 05:59 AM

Hi, I want to know how do I inject a react data table into a single view of an existing yii project.
I found a related thread in here (http://www.yiiframew...act-js-in-yii2/) and tried according to it, but it's not working.

At this point, the view can access my js file, but it does not render the react html section. Also, there is no any error displaying.

Here is my js file:(web/js/react-table.js)

var SimpleComponent = React.createClass({
render: function() {
return (
<div>{this.props.message}</div>
);
}
} );

ReactDOM.render(
<SimpleComponent message="React Demo" />,
document.querySelector( '.test' )
);

In view file there is a <div class="test"> to get the component property values.
Can anyone please explain what is wrong in here. Thanks in advance..!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users