Declarative programming

A programming paradigm in which the programmer declares properties of the desired result, but not how to compute it.


Example

React components use the declarative programming pattern. The desired result is declared and React updates the UI accordingly.

function Name({ first, last, initialOnly }) {
  if (initialOnly) first = first[0];

  return (
    <p>
      {last}, {first}
    </p>
  );
}

External Resources