Don't do this. Just read it

(Ex. Dakull) #1

tl;dr: after reading it I feel less stupid.

(Eugen) #2

Unul din efectele dezvoltarii unui app in React este ca te forteaza sa gandesti declarativ (nu imperativ).


import { div, input, button, h1 } from './elements.js'

const view = div(
  input({ value: 'Typing..', onChange: onChange, type: 'text' }),
  button({ onClick: onSubmit }, 'Send'),


const $div = $('div')
const $input = $('input').val('Typing...').on('change', onChange)
const $button = $('button').text('Send').on('click', onSubmit)
const $h1 = $('h1').text('Hello')

$div.html([ $h1, $input, $button ])

tldr: declarativ vs imperativ

Declarative programming is “the act of programming in languages that conform to the mental model of the developer rather than the operational model of the machine”.

(Ex. Dakull) #3

The irony when jQuery can be seen also as a “monad”: