setListing((prevState: any) => { const todos = [...prevState.listingTodos] const newTodos = todos.map(todo => { return { ...todo, expanded: todo.tabValue === todoValue, } }) return { ...prevState, listingLoading: false , listingTodos: newTodos, } }) // bad practice const array = [ [ [ 'Shoaib Mehedi' ] ] ] array . forEach ( ( firstArr ) => { firstArr . forEach ( ( secondArr ) => { secondArr . forEach ( ( element ) => { console . log ( element ) ; } ) } ) } ) // good practice const array = [ [ [ 'Shoaib Mehedi' ] ] ] const getValuesOfNestedArray = ( element ) => { if ( Array . isArray ( element ) ) { return getValuesOfNestedArray ( element [ 0 ] ) } return element } getValuesOfNestedArray ( array ) const { role } = user const components = { ADMIN : AdminUser , ...