I am trying to create unique ID (i cannot use any Unique ID library, i can only use math.random function) for the weight object in the constructor and then pass it in the render method.
constructor(props){
super(props);
const localDB = loadState();
this.state = {
username: localDB.account,
PrivateKey: localDB.key,
author: this.props.author,
permlink: this.props.permlink,
expanded: false,
weight : this.props.weight
};
return (
<div className="upvote">
<div id="upVote"><br /><input id="expandVote" type="button" value="Open voting UI" onClick={() => this.expandDropdown()} /></div>
{ this.state.expanded ? <input id="this.state.weight" defaultValue="10" /> : null }
{ this.state.expanded ? <button id="pushVote" onClick={() => this.pushVote()}>Push vote</button> : null }
{ this.state.expanded ? <button id="closeVote" onClick={this.closeDropdown}>Close voting UI</button> : null }
</div>
)
}