Skip to content

Extract 'em all 🤙

Compare
Choose a tag to compare
@nicoespeon nicoespeon released this 26 Aug 01:30

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:

  1. "Replace all N occurrences". This is the default since it's what we want to do most of the time.
  2. "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