I have the following ReactJS class:
import React from \'react\'
export class Content extends React.Component {
static getValue(key) {
return key
}
A static method needs to be accessed on the class not an instance. So in your case, use:
Content.getValue()
However, a static method won't be able to access this
-- I don't think you want the method to be static based on your code sample above.
More: Static Members in ES6
You can access from within the class as this.constructor.getValue
.
Edit: I've added a JSFiddle here. The only change I made was adding the function call from the constructor and removing the dangerously set innerHTML - As shown, you can access the getValue static from this.constructor, and works just fine.