question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for overriding prop values

See original GitHub issue

Not sure if this functionality is already available, but currently, if you provide another component to an attribute, the JSX that is rendered shows the value of the object instead of the displayName. For example: <Accordion.Toggle as={Card.Header} > is rendered like: <Accordion.Toggle as={{ $$typeof: Symbol(react.forward_ref), defaultProps: undefined, displayName: 'Card.Header', render: function noRefCheck() {} }} >

I would like to only show the displayName in this scenario. Is there a way to override the string the attribute returns?

If not, maybe we can make a slight adjustment to options.filterProps to work similarly to options.displayName? If you provide a function, and that function returns a string that isn’t a boolean, use that new string for the attribute value instead.

Sound good?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dvnrsncommented, Oct 19, 2020

This would be nice for really lengthy prop values as well. Say one has a long array of objects. It’d be nice to be able to render something like array or [{}, {}]

0reactions
as-zlynn-philippscommented, Mar 4, 2022

Thanks for your work, @probablyup. I hope it gets merged. Although, it doesn’t really address the need to format prop values on the fly as an escape hatch. I believe that would still be useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding props on elements - Learn Plasmic
Override props allow you to customize a component's tree of elements exactly as you see fit to make your component come alive. You...
Read more >
javascript - How to override a components props where the ...
When I receive the component, it comes with the value Type.White. I want to change it to Type.Blue. As the name suggests it...
Read more >
How to Override Existing React Components - Pluralsight
The overriding process is quite easy. Once you designate an object, it is propagated along the default props with a higher priority.
Read more >
Property value overriding | Support Center
In this quantity dropdown property. I've specified the table type by local list with values from 1 to 10.
Read more >
Override Default Props - React - Free Code Camp - YouTube
In this React tutorial we override default props. ... My goal with these videos is to support early stage programmers to learn more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found