Skip to content

Instantly share code, notes, and snippets.

View biglovisa's full-sized avatar
🌍
Patch is hiring!

Lovisa Svallingson biglovisa

🌍
Patch is hiring!
View GitHub Profile
@biglovisa
biglovisa / sample.js
Created December 16, 2015 18:50
react sample code
///// index.js
import React from 'react';
import ReactDOM from 'react-dom';
import HelloWorld from './HelloWorld';
ReactDOM.render(<HelloWorld name='Meeka' />, document.getElementById('container'));
///// HelloWorld.js
@biglovisa
biglovisa / react-notes.md
Created December 16, 2015 16:53
React in theory
@biglovisa
biglovisa / javascript-recursion.js
Last active December 15, 2015 14:17
JavaScript recursion exercises
// Write a recursive function that outputs the range between two positive numbers
// myFunction(1, 5) #=> [1, 2, 3, 4, 5]
// (5 pts)
// Write a recursive function that outputs the sum of an array of integers
// myFunction([1, 2, 3, 4, 5, 6]) #=> 21
// (5 pts)
@biglovisa
biglovisa / state-vs-props.js
Last active December 15, 2015 04:54
react: state vs props
//-------------------------------Main (parent) component
var Main = React.createClass({
// props: name (data)
// state: counter (data)
getInitialState: function() {
return { counter: 0 };
},
handleClick: function() {
this.setState({ counter: ++this.state.counter });
@biglovisa
biglovisa / 09-dec-2015.md
Created December 9, 2015 15:24
Wed December 9
@biglovisa
biglovisa / 07-dec-2015.md
Last active December 7, 2015 16:51
Mon December 7

Monday December 7, 2015

1507

Morning challenge

  • It starts out with five buttons.
  • When you click the first button, it alerts the us that "Button #1" has been clicked.
  • The equivalent works for the second, third, fourth, and fifth buttons.
  • There is an additional button for adding new buttons.
  • When added and subsequently clicked, the sixth button will log that "Button #6" was clicked.