imperative programming

A style of programming where you give explicit step-by-step commands, such as find this element and set its text.

In more detail

Most general-purpose code, such as loops that change variables, is imperative. It gives full control but makes you responsible for every step.

Example

React code is mostly declarative; focusing an input or scrolling a list are imperative jobs done through refs and useImperativeHandle.

Related terms

Taught in

References