Here I have handleFilterType function which returns a string dynamically and puts return value into filtered_value variable.
Now I need to pass this filtered_value variable to my match function. So is there any way to pass variable to match function. I tried most but I could not found the solution.
const filtered_value = this.handleFilterType(); // function return string and set into filter_value variable
const getFilterDefaultValues={({ types }) => {
const match = types.find(type => type.name.match(/filtered_value/i)); //need to pass filtered_value variable into match function
return match;
}}