static getDerivedStateFromProps()

in src/TreeMap.js [129:144]


  static getDerivedStateFromProps(newProps, state) {
    const { width, height, data, sticky } = state.prevProps;

    // if height, width, or the data changes, or if the treemap is not sticky, re-initialize the layout function
    // todo reevaluate this logic
    if (
      !sticky ||
      width !== newProps.width ||
      height !== newProps.height ||
      JSON.stringify(data) !== JSON.stringify(newProps.data)
    ) {
      return TreeMap.getStateFromProps(newProps);
    }

    return null;
  }