3 ms·
Imperative coding may be useful to for implementing the API, but that does not mean it is necessary to expose an imperative API to developers. For example, in t
by i_s 12y ago
Imperative coding may be useful to for implementing the API, but that does not mean it is necessary to expose an imperative API to developers. For example, in the browser, W3C and the browser vendors could have exposed a React-like API, implemented via an imperative internal C++ API, but instead they just gave us the DOM. I'm not saying that to complain, just to illustrate that how an API is implemented doesn't have to dictate the API you expose.
> It's funny that one of React's core ideas is to ditch the now old functional/declarative paradigm that is template languages and allows you to use imperative JavaScript to directly build up a virtual DOM.
Its agnostic about how you build up the virtual DOM, but it is common to it in a functional way, for example:
this.props.searchResults.map(this.renderSearchResult)