# ad-hok/no-flowmax-in-forwardref This rule enforces that `flowMax()` is not used inside of calls to [`React.forwardRef()`](https://reactjs.org/docs/forwarding-refs.html) ### Motivation Since `ad-hok` "magic" helpers create new React components under the hood, using a "magic" helper (inside of `flowMax()`) within `React.forwardRef()` (which gets called on every render) would result in a new React component getting created on every render, which is problematic (the component will always get remounted since React thinks it's a different component than on the previous render) So it's a good idea not to use `flowMax()` inside `React.forwardRef()` ### Solution Instead, prefer "hoisting" the `flowMax()` into a separate component defined outside of the `React.forwardRef()` call For example, instead of this: ```js const Button = React.forwardRef((props, ref) => flowMax( addPropTypes({onClick: PropTypes.func.isRequired}), ({onClick, forwardedRef}) =>