You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
707 B
16 lines
707 B
7 years ago
|
/**
|
||
|
* expr can be used to create temporarily views inside views.
|
||
|
* This can be improved to improve performance if a value changes often, but usually doesn't affect the outcome of an expression.
|
||
|
*
|
||
|
* In the following example the expression prevents that a component is rerender _each time_ the selection changes;
|
||
|
* instead it will only rerenders when the current todo is (de)selected.
|
||
|
*
|
||
|
* reactiveComponent((props) => {
|
||
|
* const todo = props.todo;
|
||
|
* const isSelected = mobx.expr(() => props.viewState.selection === todo);
|
||
|
* return <div className={isSelected ? "todo todo-selected" : "todo"}>{todo.title}</div>
|
||
|
* });
|
||
|
*
|
||
|
*/
|
||
|
export declare function expr<T>(expr: () => T, scope?: any): T;
|