Question: Im trying to upgrade a vaadin 7 app to use gwt 2.8.2. In order to do so, after changing the dependencies and setting up the gwt-maven-plugin to compile (instead of the vaadin-maven-plugin), I'm running into an issue as by default, the gwt-maven-plugin expects to find the AppWidgetset.gwt.xml in the src/main/java folder. Is there a config to point the plugin at a different location such as a resources folder? 

I have tried configuring the vaadin-maven-plugin to create/update the AppWidgetset file at src/main/java, and though it compiles, it gives the following error when calling mvn jetty:run 

```
INFO: Requested resource [/VAADIN/widgetsets/org.vaadin.alump.lazylayouts.demo.DemoWidgetSet/org.vaadin.alump.lazylayouts.demo.DemoWidgetSet.nocache.js] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

```

Answer: 
A decision to define a function within or outside of useEffect depends on where all the functions is called.

If your function is called only from within the useEffect then it makes sense to define it within the useEffect.

However is the same function is being called from within useEffect as well as other event handlers or other effects, you need to define it outside of useEffect

PS. in your case you are just updating the state for which you needn't define a separate function

```js
function App() {

  const [someState, setSomeState] = React.useState(0);
  const [someTrigger, setSomeTrigger] = React.useState(false);

  React.useEffect(() => {
    setSomeState(oldState => oldState + 1);

  },[someTrigger])

  return(
    <React.Fragment>
      <div>I am App</div>
      <div>My state: {someState}</div>
      <button onClick={()=>setSomeTrigger((prevState) => !prevState)}>Click</button>
    </React.Fragment>
  );
}

ReactDOM.render(<App/>, document.getElementById('root'));
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.3/umd/react-dom.production.min.js"></script>
<div id="root"/>
```

As far as you scenario is concerned, you would write it like

```
useEffect(() => {
    const calcVal = (oldState) => {
         // calculate previous state based on oldState
    }

    setSomeState(calcVal);
}, [activePriceFilters])

```
Setting another state should not be an effect at all.

```
 const [someState, setSomeState] = React.useState(0);

 function incrementState() {
    setSomeState(someState => someState + 1);
 }

```