某些参数使用 reactjs 返回函数错误



下面的代码应该返回我的应用程序私钥和公钥。当我运行代码时,只有私钥会收到警报并成功。

公钥引发错误TypeError: u.getPublickKeyFromPrivate 不是函数

import React, { Component } from 'react';
import {
ProfileData
} from 'bacoma';
const bacoma = require( 'bacoma' );
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
},
publicKey:  "",
};
}
componentDidMount() {
this.recordedData();
}
componentWillMount() {
const { userSession } = this.props;
this.setState({
});
}

recordedData() {
const { userSession } = this.props
var appkeyPrivate =    userSession.appPrivateKey;
alert('am privatekey: ' +appkeyPrivate);
var publicKey =    bacoma.getPublickKeyFromPrivate(appkeyPrivate);
alert('am pubick key: ' +publicKey);
console.log('iam publick key: ' +publicKey);
}
render() {
const {userSession } = this.props;
return (
// returned content here
);
}
}

关于可能是什么问题的任何想法

通过将用户会话附加到属性来解决

var publicKey =    userSession.getPublickKeyFromPrivate(appkeyPrivate);

最新更新