Skip to content

Files

Latest commit

 

History

History
20 lines (13 loc) · 366 Bytes

jsx-no-string-ref.md

File metadata and controls

20 lines (13 loc) · 366 Bytes

Pattern: Passing string to ref prop

Issue: -

Description

Passing strings to the ref prop of React elements is considered a legacy feature and will soon be deprecated. Instead, use a callback.

Example of incorrect code:

a = <div ref="value"></div>
             ~~~~~~~

Example of correct code:

a = <div ref={this.handleRef}/>