ho la classe seguenti ReactJS:chiamata una funzione statica nella classe Reagire ES6
import React from 'react'
export class Content extends React.Component {
static getValue(key) {
return key
}
render() {
let value = this.getValue(this.props.valueKey);
return <span dangerouslySetInnerHTML={{__html: value}} />
}
}
Ma ho il seguente errore:
TypeError: this.getValue is not a function
Non capisco. È questo il modo migliore per chiamare una funzione statica? Penso che reagire stia facendo qualcosa con la statica, ma non so cosa.
* "è il modo migliore per chiamare una funzione statica?" * Poiché non funziona, probabilmente no: P –