Clean up `name` argument usage in docs-demo component
See original GitHub issueCouple of issues I’m having with the name
argument for the docs-demo:
-
I get
Attempted to register a view with an id already in use: example-undefined
a lot, because I forget to add a name. If a name is required, we should assert that it exists when the component is rendered. -
It seems very verbose to require a name, and then (generally) require each snippet to set its names as well. Could we use the
name
argument to infer the snippets for the demo? Possibly allowing us to just pass intype
to each snippet?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
react-native-docs-demo-archived/.eslintrc at master - GitHub
A framework for building native apps with React. Contribute to Beomi/react-native-docs-demo-archived development by creating an account on GitHub.
Read more >v3 Documentation - React Query Builder
The context prop is passed to each and every component, so it's accessible anywhere in the QueryBuilder component tree. operators . { name:...
Read more >CLI Examples - BaseSpace Developers - Illumina
The below example commands contain example values for appsession IDs and other fields which will need to be changed for your usage. Fixed...
Read more >Use the Name Manager in Excel - Microsoft Support
You can also sort and filter the list of names, and easily add, change, or delete names from one location. To open the...
Read more >Changelog - React Magma
multiple: update components to use spacing from theme (11323d5); table: update tables ... multiple: clean up prop interfaces, props tables in docs (04b1ce3) ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How about as a first step for some sugar,
docs.example
can get named automatically (it will need some sort of key) and it automatically adds ademo.snippet
to the list of snippets, with that name. But it’s all implicitly wired up.That means the simplest version of docs-demo could be
and that would automatically render the snippet for the example. (We could add a
showSnippet=false
option todemo.example
.) Then, you could render the otherdemo.snippet
s as normal.Would that be an improvement?
While trying to use two demos without the
name
argument like so:I got this error:
This is a super confusing failure mode. I’m sharing this stack trace in case other people run into the same problem. It goes away by setting names to each example.