React-devtools: Read-only props for functional components

Created on 11 Aug 2017  路  2Comments  路  Source: facebook/react-devtools

screen shot 2017-08-10 at 4 14 31 pm

It looks like props for functional components are being marked at "read-only". From digging around,
it seems like this is because functional component instances don't have a forceUpdate() method. I definitely understand why this is, but I've seen this be confusing to developers. I can see two obvious options to help with this:

  1. Update the label in the devtools to something more descriptive than "read-only". I'd suggest "functional component (read-only)".
  2. Change the implementation to be able to edit props of all components (forceUpdate for functional component instances).

Option 1 is easier (and I'd be happy to provide a PR) but I think option 2 is the best long-term solution. From the POV of the React Core team trying to encourage people to use functional components, there probably shouldn't be any significant downsides to using them (refs aside). This would be more involved but it would lead to the devtools "just-working".

Happy to help out any way I can here.

Most helpful comment

Strangely, this still doesnt work for me. Any idea what can be the culprit?

All 2 comments

Strangely, this still doesnt work for me. Any idea what can be the culprit?

i also have this issue. it still says 'read only" props and they can't be modified.

Was this page helpful?
0 / 5 - 0 ratings