Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Conversation

@bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jul 10, 2017

As the gif below shows, elements with props (other than children) have a right-click option to copy props to clipboard. All props (excluding children) are copied as JSON. This may be helpful to people wanting to quickly copy "production" values out for testing/stubbing purposes.

Is this useful?

copy-element-props-

Resolves #833

@alexkrolick
Copy link
Contributor

This is really useful!

@bvaughn bvaughn force-pushed the copy-element-props-menu-option branch from c955fb5 to 6e3a609 Compare July 11, 2017 17:21
Copy link
Contributor

@jaredly jaredly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, this will be super useful

// Convert functions to '[function]'
stripFunctions(cloned);

return JSON.stringify(cloned, null, 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you wrap this in a try/catch? there are some things that might throw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. That seems like a good safety step.

@bvaughn bvaughn merged commit 2c57215 into facebook:master Jul 11, 2017
@bvaughn bvaughn deleted the copy-element-props-menu-option branch July 11, 2017 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants