Comments (7)
Hey @sibelius! Thanks for reporting, I will fix this soon.
from babel-plugin-functional-hmr.
@sibelius Could you provide some more context?
from babel-plugin-functional-hmr.
Getting the same thing. I think I've narrowed it down to the ...props
. Seems like it's barfing on the "rest" syntax
from babel-plugin-functional-hmr.
@kylealwyn @sibelius I'm not a JS expert but it seems like invalid syntax to me: AFAIK you can't use spread syntax in a destruct expression (props
). Valid syntax would be:
export const Text = ({ style, children, capitalized, props }: Object) =>
<RNText style={[styles.font, style]} {...props}>
{capitalized ? capitalizeFirstLetter(children) : children}
</RNText>;
from babel-plugin-functional-hmr.
In fact, you can
from babel-plugin-functional-hmr.
@sibelius seems like you are way more experienced than me please help me and send a PR with the fix
from babel-plugin-functional-hmr.
@bvic23 The syntax and method is called "rest" parameters: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
It works the same for arrays as it does with objects. when destructuring, it effectively assigns the rest of the object or array into the variable. take for example:
const obj = {
a: 1,
b: 2,
c: 3,
};
const { a, ...rest } = obj;
// a is 1 here, rest is { b: 2, c: 3 }
This method works nicely with React because you may only want to pluck a couple properties out of the props arg and pass the rest down to the native view.
I have no experience with babel transforms and it's AST process but I'm happy to help in any way
from babel-plugin-functional-hmr.
Related Issues (14)
- Bundling app does not work HOT 3
- Error in React Native 0.53 HOT 8
- Support for higher-order-components such as recompose HOT 5
- Issue with HMR with fragment syntax HOT 2
- Not working on react-native 0.57.7 HOT 1
- Any idea why unit tests are failing after enabling HMR?
- Won't work with hooks HOT 1
- Couldn't find preset "functional-hmr" relative to directory "MyApp/storybook" HOT 6
- Deprecating the package HOT 2
- support for non-jsx react components HOT 1
- setup help HOT 7
- Component is not rendered correctly if its stored in variable named 'Item' HOT 1
- [RN 0.52.0] Unknown named module: 'react' HOT 10
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 babel-plugin-functional-hmr.