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.

Set global default props

See original GitHub issue

Is there a way to use tippy.setDefaultProps or otherwise set default props for all Tippy components? Using tippy.setDefaultProps doesn’t seem to influence react components. One option could be creating a proxy component, but that breaks props autocompletion for VSCode.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
atomikscommented, Mar 28, 2020

Repro: https://codesandbox.io/s/pensive-bhabha-s7n4s

Make sure you’re importing Tippy from a central local module/file and only calling setDefaultProps once in that module, that might be the issue.

0reactions
rontavcommented, Mar 28, 2020

I should’ve done this from the start, but here’s what I want to do: https://codesandbox.io/s/heuristic-herschel-71kwh. As you can see, I’ve tried using tippy without react and the output is the same. Maybe this issue should be moved to tippyjs.

From what I get by reading the source code of tippy, this should be a supported use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default /global props for Text, TextInput, etc #462 - GitHub
Current behaviour Component-specific props can't be set in the theme. Only a few styles such as font family, color etc may be globally...
Read more >
React: Everything about Default Props | by Chidume Nnamdi
In this post, we'll learn all about default props in React. ... All these combined together create a UI widget.
Read more >
Initializing Text.defaultProps with Typescript - Stack Overflow
I just started rewriting my existing react-native project from js to typescript. To disable font scaling, I set ...
Read more >
React set Default Props - DataDrivenInvestor
Because creating React components can be done in many ways. I will show how to set default props in functional components and class-based...
Read more >
How to set default props in React - Educative.io
To set a default value for the color prop, use the defaultProps property of CustomButton to set the default value of color to...
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