In React(axios), I am trying to filter response data using 2 variable arguments. These variables are set from a setState on hud.js. The value I need to access should be filtered from the response data with the element combination being in a column called Combo and the second being in a column named Result, and will return "Smoke" to the hud.js in the "combined element" state. I can call the table fine by can't get it too accept any args to filter. I'm sure i just have the syntax wrong but can't figure out where.
hud.js
export default class Hud extends Component {
constructor(props) {
super(props);
this.state = {
element1: "blank",
element2: "blank",
combinedElement: "blank",
form: "blank",
spell: "blank",
};
setFireMana = () => {
if (this.state.element1 == "blank") {
this.setState({ element1: "Fire" });
} else {
this.setState({ element2: "fire" });
}
}
combineElements = () => {
const elementsToCombine = element1/element2;
if (element2 !== "blank") {
axios.get(`http://127.0.0.1:5000/Element`).then((response) => {
console.log(response.data.filter(Combo === `${this.state.element1}/${this.state.element2}`))
})
};
};
<div className="foreground">
<div className="left-side">
<div className="live">{this.state.element1}</div>
<div className="dead">{this.state.combinedElement}</div>
</div>
<div className="right-side">
<div className="live">{this.state.element2}</div>
<div className="dead">{this.state.form}</div>
</div>
</div>
</div>
<div className="hud">
<div className="mana">
<button onClick={this.setFireMana}>
<img src={fireicon} />
</button>