JavaScript In React, how to call multiple functions with their own arguments? react call multiple functions onclick,react call multiple apis,react

I want to call two functions passes via props on click. Note that both of them need arguments of their own. After a bit of searching on Stack Overflow, I found this solution:

onclick={()=>{ f1(); f2() }}

So I implemented mine as follows:

onClick={() => {f1(arg); f2.bind(this, arg)}}

But the second function never gets called. Can anyone please explain why this isn't working? I'm assuming its some binding issue?

f1 is in the parent component:

f1(arg, event)
{
        event.preventDefault();
        // so on...
}

f2 is also in the parent argument as follows:

f2(arg)
{
     // do something with the arguement 
}

They are getting passed to the child component

 render()
    {
            const { f2, arg, f1 } = this.props;

            return(
                <button onClick={() => {f2(arg); f1.call(this, arg)}}>
)
    }
Answer:1

Try this way

 onClick={(arg)=>{ this.f1(arg); this.f2(this, arg) }}

Or make a separate function call as below.

onClick={(arg)=>{ this.f1(arg) }}

f1(values){
this.f2(values);
}
Answer:2

Rather than use the likes of Redis, or even LokiJS (which looks great), can I just create a large javascript collection in memory as my app runs, and query that instead?

Rather than use the likes of Redis, or even LokiJS (which looks great), can I just create a large javascript collection in memory as my app runs, and query that instead?

I am having a big array (length:10k) of coordinates (rawData = [x,y1,y2,y3,...]) as follows: rawData = [ {x: 1, y1: 1, y2: 13, y3: 2}, {x: 2, y1: 2, y2: 23, y3: 2}, {x: 3, y1: 3, y2: 33, ...

I am having a big array (length:10k) of coordinates (rawData = [x,y1,y2,y3,...]) as follows: rawData = [ {x: 1, y1: 1, y2: 13, y3: 2}, {x: 2, y1: 2, y2: 23, y3: 2}, {x: 3, y1: 3, y2: 33, ...

I have an array like this: const teamsPoints = [ {team1_game00: 1}, {team1_game01: 2}, {team1_game02: 3}, {team2_game00: 0}, {team2_game10: 2}, {team2_game11: 3}, {team3_game01: 0}, {...

I have an array like this: const teamsPoints = [ {team1_game00: 1}, {team1_game01: 2}, {team1_game02: 3}, {team2_game00: 0}, {team2_game10: 2}, {team2_game11: 3}, {team3_game01: 0}, {...

  1. reduced order method

I have an array object where there are key value pairs. I am trying to get the keys in that array using a loop but I am getting only 0. What is the problem with my code. var strj = '{"name":"John",...

I have an array object where there are key value pairs. I am trying to get the keys in that array using a loop but I am getting only 0. What is the problem with my code. var strj = '{"name":"John",...

  1. cannot open .get/fetch_head
  2. apt-get cannot fetch
  3. fetch cannot get
  4. you-get cannot fetch video
  5. fetch cannot get headers