Today, while I was working on a bug, I found myself needing to copy a props of a React component, so I realized that the react dev tools did not have this functionality, after some searches, i found the solution.
EDIT: react dev tools has a pretty simple solution, thanks to Eugene
- Open the ReactDevTools in Browser
- Select the component that contains the props, in that you need copy
(when you make this, the browser will be create a variable for save the component that you clicked, generally the name is $r)
- Open the console, and save the prop in another variable
- Use the copy method and "don't worry, be happy! :D" as me.
Cheers! ๐ ๐ โค๏ธ
Top comments (9)
Nice tip! Only now I'm having the opportunity to get deeper with React. This will be helpful.
I'm really glad to hear that. thanks! โค๏ธ โค๏ธ
Nice tip! There is also an easier way - just right-click on an element and select 'Copy element props'.
![copy props](https://res.cloudinary.com/practicaldev/image/fetch/s--pd4mgAHW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/t86u31188z5s1vyc8rff.jpg)
I didn't know, thank you! โค๏ธ
Nice! This is gonna help a future searcher.
yes, of sure! ๐
Nice one!
Reminds me of my first encounter of the same situation. I was aware of $, $$, $1 in DOM element panel, but no idea about React.
Definately a help for fellow dev.
Cool!