How does the BasicLayout.js file in Ant Design Pro call the formatter function?

clipboard.png

BasicLayout.js is also const children = formatter (the formatter function is called in item.routes, item.authority, locale); , but the debugger that runs in the order of 25 lines) starts running, and at this time data already has the data, where did this data come from? How does the formatter function work?

Nov.26,2021

is the value of item.routes . The parameter passed is


.

search with formatter is wrong. There is a sentence const memoizeOneFormatter = memoizeOne (formatter, isEqual); in the code, and then you can find it with memoizeOneFormatter search.

  getMenuData() {
    const {
      route: { routes },
    } = this.props;
    return memoizeOneFormatter(routes);
  }

is called here.

Menu