edifice.Component.should_update

Component.should_update(newprops, newstate)[source]

Determines if the component should rerender upon receiving new props and state.

The arguments, newprops and newstate, reflect the props and state that change: they may be a subset of the props and the state. When this function is called, all props and state of this Component are the old values, so you can compare component.props and newprops to determine changes.

By default, this function returns true, even if props and state are unchanged.

Parameters
  • newprops (PropsDict) – the new set of props

  • newstate (Mapping[str, Any]) – the new set of state

Return type

bool

Returns

Whether or not the Component should be rerendered.