My problem is simple and I couldn't find the proper answer in this forum. My bad...
I want to do that :
const dataReceived = foo;
foo(state);
How can I do that? I read it is better to avoid eval, and I couldn't get success with new Function. Thanks for your help!
EDIT Thanks for your answers. I work with React. In my reducer, I have a create_item case. I can reach action.category, that can be the word 'currency' or 'country'.
What I want to do is to launch either the method createCurrency or createCountry according what is inside action.category. That's why I tried to join 'create' and 'action.category' to create a dynamic function name. But it seems to be a poor idea...