Consider this:

```
function helperFunction (text, setState) {
    setState({
        value: "some value",
        text: text
    });
    return "result";
}

function mainFunction (state, setState) {
    switch (state.value) {
        case "" : return helperFunction("empty string", setState);
        case "aaa" : return helperFunction("the string is aaa", setState);
        case "bbb" : return helperFunction("the string is bbb", setState); 
        case ...
        default ...
    }
}

```

These functions are in external file so I have to pass setState reference in order to be able to update the state (via useReducer/useState Hooks). 

`helperFunction` is a helper function, and I want to optimize this code and get rid of necessity of passing `setState` reference to it **every time/case**, which is always the same for the `mainFunction`.

How do I can pass setState to `helperFunction` as a default for the `mainFunction`?

To be clear

I want: 

```
case "aaa" : return helperFunction("the string is aaa");

```

instead of:

```
case "aaa" : return helperFunction("the string is aaa", setState); 

```

What is the "best practices" for this case?

PS: `helper` is a universal, and I need to be able to change its defaults depending on function that is running it.

Update: some answers suggest to put it inside the mainFunction - I can't do this, helper is a universal function, any function should be able to run it.