Skip to content

Instantly share code, notes, and snippets.

import React, { useState } from 'react';
function Todolist() {
const [todo, setTodo] = useState({description: '', date: '', priority:''});
const [todos, setTodos] = useState([]);
const inputChanged = (event) => {
setTodo({...todo, [event.target.name]: event.target.value});
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>React getting started</title>
</head>
<body>
<!-- Root container for react components -->
<div id='root'></div>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>React getting started</title>
</head>
<body>
<!-- Root container for react components -->
<div id='root'></div>
import React, { useState } from 'react';
import { StyleSheet, View, KeyboardAvoidingView } from 'react-native';
import * as firebase from 'firebase';
import { Input, Button, ButtonGroup, Text } from 'react-native-elements';
const AddTodo = (props) => {
const [todo, setTodo] = useState({title:'', date: '', category: '', description: ''})
const [expanded, setExpanded] = useState(true)
const [selectedIndex, setSelIndex] = useState(0);
const {navigate} = props.navigation
@juhahinkula
juhahinkula / index.html
Created November 13, 2019 11:50
Counter using useReducer
<!-- Fetch astronomy picture of the day from NASA API -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>React example</title>
</head>
<body>
<!-- Root container for react components -->
<div id="root"></div>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue.js</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
import React, { useState } from 'react';
import { StyleSheet, View, Text, Button, TextInput, FlatList } from 'react-native';
export default function App() {
const [numA, setNumA] = useState(0);
const [numB, setNumB] = useState(0);
const [result, setResult] = useState(0);
const [history, setHistory] = useState([]);
const calcSum = () => {
import React, { useState } from 'react';
import './App.css';
function App() {
const [todo, setTodo] = useState({desc: '', date: ''});
const [todos, setTodos] = useState([]);
const addTodo = (event) => {
event.preventDefault();
setTodos([...todos, todo]);
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>React getting started</title>
</head>
<body>
<!-- Root container for react components -->
<div id='root'></div>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>React getting started</title>
</head>
<body>
<!-- Root container for react components -->
<div id='root'></div>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>