我有以下课程:
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}} />
}
}
但我有以下错误:
TypeError: this.getValue is not a function
我不明白.这是调用静态函数的好方法吗?我认为react是在用静力学做一些事情,但我不知道是什么.