message: feat(pattern): updated the reviews
diff: @@ -32,26 +32,13 @@ const { prefix } = settings;
  const TableOfContents = ({ menuItems, children, menuLabel, theme }) => {
  const [selectedId, setSelectedId] = useState(menuItems[0].id);
  const [selectedTitle, setSelectedTitle] = useState(menuItems[0].name);
  - const [setmenuItems] = useState([]);
  useEffect(() => {
  - /**
  - * Set selected id & title
  - *
  - */
  - if (menuItems) {
  - var setSelectedItem = () => {
  - const elems = getElemsInView();
  - const id = elems[0] || menuItems[0].id;
  - const filteredItems = menuItems.filter(menu => {
  - if (id !== 'undefined') {
  - return menu.id == id;
  + if (!menuItems || menuItems === undefined || menuItems === null) {
  + findMenuItems();
  }
  + scrollStop(setSelectedItem);
  });
  - const title = filteredItems[0].title;
  - setSelectedId(id);
  - setSelectedTitle(title);
  - };
  - }
  +
  /**
  * loops into the array of elements and returns the values
  *
  @@ -69,11 +56,22 @@ const TableOfContents = ({ menuItems, children, menuLabel, theme }) => {
  return menuItems;
  };
  - if (!menuItems || menuItems === undefined || menuItems === null) {
  - setmenuItems(findMenuItems());
  + /**
  + * Set selected id & title
  + *
  + */
  + const setSelectedItem = () => {
  + const elems = getElemsInView();
  + const id = elems[0] || menuItems[0].id;
  + const filteredItems = menuItems.filter(menu => {
  + if (id !== 'undefined') {
  + return menu.id == id;
  }
  - scrollStop(setSelectedItem);
  - }, [menuItems, setmenuItems]);
  + });
  + const title = filteredItems[0].title;
  + setSelectedId(id);
  + setSelectedTitle(title);
  + };
  /**
  * Check whether provided anchor tags are in visible viewport
  