Skip to content

Instantly share code, notes, and snippets.

// tohle je prostě entry point pro kód buďto webovej nebo nativní - můžeš udělat kolik endpointů chceš pro jako platformu
import * as actions from './actions'
import { createStore } from 'redux'
// v native-entry.js si requirneš jinej router prostě, zbytek bude prakticky stejnej
import Router from 'router'
import routes from 'routes'
import { Provider } from 'redux-react'
Router.config({ routes })
function asyncIter(arr, fn, errCb) {
var i = 0
function runIt() {
try {
fn(arr[i], i, function() {
i++
if (i < arr.length) {
setTimeout(runIt, 5)
}
//pohoda, žádnej callback
const fn = (props) => {
return div({
}, props.text)
}
// budu chtít zařídit to, aby se po kliknutí něco stalo
props.onClick = (event) => { //pičoviny }
// template.php
<ul class="posts">
<?php foreach ($properties['posts'] as $post): ?>
<li>
<?= $post->title ?>
</li>
<?php endif; ?>
</ul>
// does this seem to you as crazy?!
// K čemu to je?
// Varianta 1. importování
import classes from './styles'
export default ({ visible }) => {
return (
<div className={visible ? classes.visible : classes.invisible}>This is some text</div>
)
// K čemu to je?
// Varianta 1. importování
import classes from './styles'
export default ({ visible }) => {
return (
<div className={visible ? classes.visible : classes.invisible}>This is some text</div>
)
const style = Stylesheet.create({
visible: {
display: block,
color: 'red',
},
invisible: {
display: none,
},
})
import classes from './styles'
export default ({ visible }) => {
return (
<div className={visible ? classes.visible : classes.invisible}>This is some text</div>
)
}
const asyncFn = (email) => {
return new Promise((resolve, reject) => {
$.get('//idnes.cz/' + email, (err, result) => {
if (err) {
return resolve({
status: 'fail',
email: email,
})
}
import React from 'react'
export default class React extends React.Component {
state = this._getState(this.props)
_getState() {
return {
shouldDisplayOnboarding: this.context.onboardingStore.shouldDisplayCommonOnboarding(this.props.appLocation)