Skip to content

Instantly share code, notes, and snippets.

@roryhow
roryhow / Two.js
Last active August 7, 2018 09:15
One file taken from a demo export of Supernova Studio
import React from "react"
import { StyleSheet } from "react-native"
import { View, Image, Text } from "react-native"
import { strings } from "./../Locales/i18n"
export default class Two extends React.Component {
static navigationOptions = ({ navigation }) => {
const { params = {} } = navigation.state
return {
header: null,
@roryhow
roryhow / One.js
Created July 23, 2018 11:38
One file taken from a demo export of Supernova Studio
import React from "react"
import { StyleSheet } from "react-native"
import { View, Image, Text } from "react-native"
import { strings } from "../Locales/i18n"
export default class extends React.Component {
static navigationOptions = ({ navigation }) => {
const { params = {} } = navigation.state
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
// Action creator
const toggleTodo = isChecked => ({
type: 'TOGGLE_TODO',
isChecked,
});
;; Here we are importing re-frame.core (our SPA library and referring to it as rf for brevity)
(ns simple.core
(:require [re-frame.core :as rf]
[clojure.string :as str]))
;; Event Handler
(rf/reg-event-db ;; By calling the reg-event-db function we can register an event handler
:change-checkbox ;; for when the :change-checkbox event is dispatched
(fn [db [_ new-value]] ;; we then supply a function that takes the db and an event vector as 2 the 2 parameters
(assoc db :is-checked new-value))) ;; we update the DB map (think similar to a JS object) :is-checked value to the new value and return