Banshee
Banshee

Reputation: 15807

Variables within class?

I have a class that looks like this :

var GridBox = React.createClass({
        loadLoadDataFromServer: function(modifier) {

        },
        handlePaging: function(modifier) {

          },
        getInitialState: function() {

        },
        render: function(){
            return (

            );
        }
    });

How do I add a variable within this class that all of the functions can use?

Upvotes: 2

Views: 72

Answers (1)

Oleksandr T.
Oleksandr T.

Reputation: 77482

Like this

var GridBox = React.createClass({
    a: 10,

    handlePaging: function(modifier) {
        console.log(this.a);
    }
});

Upvotes: 3

Related Questions