Don't fetch value from constant
See original GitHub issueExample:
// Button.js
export const PRIMARY = Symbol();
export default const Button = (props, children) => {
switch (props.type) {
case PRIMARY:
theme = 'Button--primary';
break;
}
return (<button className={ theme } { ...props }>{ children }</button>)
}
export default Button;
// view code-block
import jsxToString from 'react-element-to-jsx-string';
import Button, { PRIMARY } from 'Button.js';
console.log(jsxToString(<Button type={PRIMARY}>Primary</Button>))
My Problem is that the constant is not PRIMARY
but Symbol()
:
<Button type={Symbol()}>
Primary
</Button>
Is there a way to workaround that?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
c# - Get value of constant by name - Stack Overflow
To get field values or call members on static types using reflection you pass null as the instance reference.
Read more >Don't Use Constants as Default Values in Entities
An issue while using constants as initial values for entity fields ... using an Object-Relational Mapper(ORM) to fetch persisted entities.
Read more >mysql - Get a fixed value on a select
I just need the query to return this field with a fixed value; in this case a value in USD. How do I...
Read more >Constant fetching value even after deletion. - Appian Community
I observed a strange behavior in Appian 16.2, A constant value is reflecting in one interface whereas I have deleted that constant permanently...
Read more >Python Constants: Improve Your Code's Maintainability
If you need to update the constant's value, then you don't have to ... with a wildcard import will just get the greet()...
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
ok, I got that. But still, now I see this:
but I expect this:
I close this issue for now. If you have any comments on this do not hesitate I will reopen it 😃