riot
Version:
Simple and elegant component-based UI library
18 lines (15 loc) • 504 B
JavaScript
/* Riot v10.1.2, @license MIT */
import { callOrAssign } from '../dependencies/@riotjs/util/functions.js';
/**
* Compute the component current state merging it with its previous state
* @param {object} oldState - previous state object
* @param {object} newState - new state given to the `update` call
* @returns {object} new object state
*/
function computeComponentState(oldState, newState) {
return {
...oldState,
...callOrAssign(newState),
}
}
export { computeComponentState };