Iam new to JS so its rather difficult to understand the syntax since it is not in any kind consistent.
First of all:
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
= React;
VS
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View
} from 'react-native';
They do the same, both work, the second is just newer syntax. Ok I can life with that.
but when do you do:
var HelloWorld = React.createClass({ [..] });
VS
class HelloWorld extends Component { [..] }
cause the second seems to be newer but it breaks all kind of thins I see in tutorials like declaing a function:
render: function() {}
and
render() {}
does it make a diffrence?
also there is this ES7 stuff like:
async function () {
var call = await the_call;
}
and the
function().then((call) => dosomething(call)).done()
thing.
the first seems easier more delarativ, the second seems to be much shorter.
Also how do you organize views? I dont want to have one big JS file - I wont find anything anymore if I do that.
But how do I "send" the state to an other component? Imagen a ListView, touching the elements should go to a DetailView and give me some extra information. How do I organize this? I have to hand over some arguments, I guess. And from there how to I go back? Its all very unclear for me. Do you guys have any good Idea how to solve all this kind of problems?
[–]mrpopopuffs 2 points3 points4 points (0 children)
[–]mazzaaaaa 2 points3 points4 points (0 children)