Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 1.08 KB

no-render-return-value.md

File metadata and controls

26 lines (16 loc) · 1.08 KB

Disallow usage of the return value of Inferno.render (inferno/no-render-return-value)

💼 This rule is enabled in the ☑️ recommended config.

Inferno.render() (inferno-compat) currently returns a reference to the root InfernoComponent instance. However, using this return value is legacy and should be avoided because future versions of Inferno may render components asynchronously in some cases. If you need a reference to the root InfernoComponent instance, the preferred solution is to attach a callback ref or createRef() to the root element.

Rule Details

This rule will warn you if you try to use the Inferno.render() return value.

Examples of incorrect code for this rule:

const inst = Inferno.render(<App />, document.body);
doSomethingWithInst(inst);

Examples of correct code for this rule:

Inferno.render(<App ref={doSomethingWithInst} />, document.body);

Inferno.render(<App />, document.body, doSomethingWithInst);