Rules should not accept unstable values created with function.
For example:
This should be considered warnings, but currently not:
function bar() {
return {} // can be objects, arrays, functions, jsxs
}
const foo = bar()
<Item config={foo} />
This should be considered valid:
function bar() {
return {} // can be objects, arrays, functions, jsxs
}
const foo = useMemo(bar(), []) // wrapped with useMemo
const foo = useOtherCustomHook() // this will make sense after resolved https://github.com/cvazac/eslint-plugin-react-perf/issues/76
<Item config={foo} />
This should be still considered valid:
function bar() {
return 'bar' // can be any other primitives
}
const foo = bar()
<Item config={foo} />
Rules should not accept unstable values created with function.
For example:
This should be considered warnings, but currently not:
This should be considered valid:
This should be still considered valid: