3 ms·
The `render()` function describes the look of the UI. With "traditional" libraries, you either have to imperatively mutate the initial UI (e.g. `button.setText
by realharo 9y ago
The `render()` function describes the look of the UI.
With "traditional" libraries, you either have to imperatively mutate the initial UI (e.g. `button.setText`, `layout.addWidget(new Button)`, `removeWidget(button2)`) or use data-bindings which are pretty limited and you often have to adapt your data for them.
With React, you write the `render()` function that answers the question "given this state, how does the UI look?".
- altcognito 9y agoWith Turbo Pascal's widget system you could describe the UI with a data structure from functions (not just the initial state), and it would bind those UI structures to a database (depending on the application). I'll admit, it's not the default way people generally built applications, built, but it could be done.
- nurettin 9y ago"traditional" frameworks have had the concept of "design time" since the 90s. Unless you were writing winapi using notepad and compiling with cl.exe
- realharo 9y agoThat has nothing to do with it. Most UIs display some kind of data to the user. When the data changes, how do you update the UI?
- nurettin 9y agoFor example: In Qt you can bind signals and slots in the form editor declaratively. This way when a widget signals text change, another widget's set text is automatically called.