0

I have ngReact installed and I am able to create a basic component (Hello World) in my Angular 1.3 project using this article: https://www.logilab.org/blogentry/7366955

But I am not sure how to use react-data-grid in my Angular app. What component name does one use? Has anyone done this? I would welcome a little guidance! Thanks!

1 Answers1

0

Not knowing much of angular just by reading your article you will need to do a few things.

You will need to import react-data-grid as a script, you can check they way to do it in here.

After that ReactDataGridcomponent will be available to you and you can do the same thing you do for the example in your link. If you're not using jsx it will be better if you take a look in here. The final code for you will be something like this

 // define a React component that displays "Hello {name}"
 var GridComponent = React.createClass({
    render: function() {
       var props = { x: this.props.x, y: this.props.y ...};
       // you can filter the props or just inject this.props
       return React.createElement(ReactDataGrid, props, null);
    }
 });

To use that you just need to create the grid controller that will look something like this:

 <div ng-app="app" ng-controller="helloController">
   <react-component name="GridElement" props="yourProps" />
 </div>
Diogo Cunha
  • 1,194
  • 11
  • 23
  • I can't get past "ReferenceError: ReactDataGrid is not defined". I have included in script tags, react-datagrid.js, react.js, react-dom.js and ngreact.js. I am not sure what else I need to do to make ReactDataGrid available. I used your code and just put it as a script tag on my page. Not sure what I need to do....Really new at this stuff. – Gil Caraff Jan 20 '17 at 21:25
  • What are you including in the script tag? It should be – Diogo Cunha Jan 21 '17 at 12:04
  • You have been much help! I found the error in the script tag. Now I am getting: Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). I am using your sample source. Any ideas? – Gil Caraff Jan 22 '17 at 16:33