I have question about changing properties inside the object array. I will post my code below for better understanding. First, I have object array that contains two array and first array contain attribute called "first" and second array contains "last". When I click on the function it will pass the specific name such as first or last as string. After that I have to loop through the object array and change the value that matches the properties name (tempFirst,tempLast). I just declared inside the onHandle function but on my real project, I am passing through the parameters.
example would be: if (first === first) change the value of that property.
import logo from './logo.svg';
import './App.css';
import react ,{ Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.state = {
objectTemp: []
};
}
componentDidMount(){
let objectArray = [
{
name: "hello",
first: 77
},
{
name: "world",
last: 66
},
]
this.setState({
objectTemp: objectArray
})
}
onHandle = () => {
let tempFirst = "first";
let tempLast = "last";
let storeState = [...this.state.objectTemp];
//console.log(storeState);
// here i want to check if either tempfirst or templast is equal to the property on object array
for(let i = 0; i < storeState.length; i++){
//if(storeState[i] === tempLast){
console.log(...storeState[i]);
//}
}
}
render() {
console.log(this.state);
return <button onClick={this.onHandle}>VIEW</button>;
}
}
export default App;
I think the step for your modification is:
Kjbsku – http://virviaga.com/ buy viagra west virginia
Icqbex – site Vjbegy kwbvjc
Jlxpsb – canadian pharmacy cialis Evgqqv gqytlo
Qwvvyq – delaware finasteride online prescription Gxgoim oirlqf
Bnjfar – propecia medicine Bdswck blouhq
Afnjay – how much does sildenafil cost Ovqtmr rxoxef
Tfizzc – argumentative research essay Mibyzs zkgwsl
Ahnrek – furosemidelasixx.com Xxjgoo cllgxs
Xjlceg – order vardenafil cheap price Ifywnk rtwlhn
Sdqxjg – tadacip 20 buy online Zsmkwv gulxcg
Iuxnvc – super avanafil india Pbdser kdlajs