• Packages
  • Themes
  • Documentation
  • Blog
  • Discussions
Sign in

extract-component

Provides an Extract Component refactoring task. Takes a selected JSX snippet and extracts it into a new component.
bspaulding
1.0.1 145
0
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

extract-component package

Refactoring task to extract a portion of JSX as a new component.

TODO

x Prettier indentation on both removed and inserted text / Look for var refs and transform to props - done-ish, currently looks only for MemberExpression names would be better if became:

		const Component = ({ src }) => (
		<Image src={src}/>
	  )

	although this would introduce complexity and probably new edge cases
  • grab jsx component imports
  • restore focus to active editor on modal close
    • this should be working, not sure why it isn't
  • save the new component file immediately?
  • add new import last?
  • Allow for leaving children in place, only extracting wrapping element as component
  • Leave children by default, by UI option, or by separate command?

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by