Comments (9)
The documentation for this plugin is slightly incomplete. The reason I had to include it in my babelrc after upgrading to babel6 is to be able to assign jsx elements to jsx attributes. Otherwise, I'd get errors of this sort:
Module build failed: TypeError: App.js: Property value of JSXAttribute expected node to be of a type ["JSXElement","StringLiteral","JSXExpressionContainer"] but instead got "CallExpression"
For such code:
<Tab value="dashboard"
icon={<FontIcon className="material-icons">dashboard</FontIcon>}
label="DASHBOARD"
/>
Removing icon= fixes it.
from react-slingshot.
@halayli Per the docs it should only be enabled in production, so how would this solve your problem in dev?
from react-slingshot.
I had to enable in babelrc's development env. I couldn't find any other solution for now. This problem only showed up after I upgraded to babel 6.
from react-slingshot.
Ouch. Given the negative development impact, I definitely can't wire it up in dev. I've never seen this pattern before. Could you nest FontIcon as a child of Tab instead?
from react-slingshot.
This is a very common pattern in material-ui and ui-related libs in general. It's a handy pattern. I am not sure FontIcon can nest in the child but there are plenty other components that have other attributes taking jsx elements.
Given it's implications I understand why you wouldn't add it to dev. But I wonder how it was working in babel 5.x.
from react-slingshot.
@halayli you say
to be able to assign jsx elements to jsx attributes
Weird works for me .. i do this all the time, just not inline but using a variable:
const iconJsx = <FontIcon className="material-icons">dashboard</FontIcon>
return <Tab value="dashboard" icon={iconJsx} label="DASHBOARD"/>
from react-slingshot.
@barrystaes it works with variables but not when you assign directly to icon.
from react-slingshot.
TLDR; I think the strength of react-slingshot is being complete but not complicated.
I dont think this addition makes it that much more complete to warrant the additional complexity. 👎
Long version; @coryhouse asks
Potential performance enhancement: https://babeljs.io/docs/plugins/transform-react-inline-elements/
Need to test and decide if the benefits justify the downsides. Any opinions?
I also vote against using it in react-slingshot
.
From my viewpoint and that of a new user, i think this just complicates things (sourcecode readability, output code readability, debugability) but does not add value / solve a problem that i experience or even know of.
from react-slingshot.
Gotta agree with you @barrystaes. Thanks for the input! Until there's an alternative without the big downsides, this will have to stay out of the kit. Going to go ahead and close this as "won't fix" since there's nothing actionable we can do at this time.
from react-slingshot.
Related Issues (20)
- Use redux-saga
- npm run remove-demo doesn't work
- Terminal font becomes invisible after npm start
- Error running 'npm install' HOT 1
- Switch Redux logic setup to use Redux Toolkit HOT 4
- Involving Database HOT 4
- why there are yarn.lock and package-lock.json both present? HOT 6
- Implementation of redux-persist with react-slingshot HOT 5
- [WARNING] Removing the demo app also removes files that do not belong to the demo app
- Get error when execute "npm start" command. HOT 1
- Required Information about peripheral files. HOT 2
- Update README about python version HOT 1
- Refused to execute inline script because it violates the following Content Security Policy directive:
- facing issue while npm run setup HOT 2
- Opentest issue
- npm run on production environment
- Add Flow please
- npm ERR! [email protected]
- jest: not found
- Build 16x fails not 18x or 20x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-slingshot.