Extract 'em all 🤙
Added
- [New Refactoring] Replace Binary with Assignment
Changed
Extract Variable now handles extraction of multiple occurrences!
If the extracted variable has no other occurrence in scope, it will just perform the extraction as it does today.
But if we can find other occurrences of the variable in the scope, then it will ask you what you want to do:
- "Replace all N occurrences". This is the default since it's what we want to do most of the time.
- "Replace this occurrence only". In case you only want to extract this one.
Fixed
- Extract Variable now works for call expressions in JSX Elements (e.g.
<Button onClick={this.extractMe()} />
) - Extract Variable now works in for statements