#### Menu List receives a default function. Uses value prop as parameter in the function for each element
```js
import React, { useState } from 'react';

let firstArray = [{name: "Roger", id: 65},{name: "Irving", id: 615},{name: "Esme", id: 10},{name: "Alex", id: 500}]
const [array, setArray] = useState(firstArray);

const sortFunc = (a, b, property) => {
  if (typeof a[property] === 'string')
    return a[property].localeCompare(b[property]);
  return a[property] - b[property];
}
const defaultFunc = (value, params)=>{
  if (value === 'default') {
    setArray(firstArray);
    return;
  }
  const otherArray = [...array];
  setArray(otherArray.sort((a,b) => sortFunc(a,b,value)));
}

const List = (props) => {
  return props.array.map((e) => <div>{`${e.id}: ${e.name}`}</div>
);}

<div>
  <MenuList
    label={'Sort by'}
    placeholder={"Placeholder"}
    defaultFunction={defaultFunc}
  >
    <MenuList.Element value={"name"}>Name Name Name</MenuList.Element>
    <MenuList.Element value={"id"}>Id</MenuList.Element>
  </MenuList>

  <List array={array}></List>  
</div>
```

#### Each option receives a custom function. 

Menu list aligned to the right

```js
import React, { useState } from 'react';

let firstArray = [{name: "Roger", id: 65},{name: "Irving", id: 615},{name: "Esme", id: 10},{name: "Alex", id: 3430}]
const [array, setArray] = useState(firstArray);

const sortString = (a, b) => a.name.localeCompare(b.name);

const sortInt= (a, b) => a.id - b.id;

const defaultFunc = (value, params) => {
   setArray(firstArray)
};

const stringSortFunc = (value, params)=>{
  const otherArray = [...array];
  setArray(otherArray.sort(sortString));
}

const intSortFunc = (value, params)=>{
  const otherArray = [...array];
  setArray(otherArray.sort(sortInt));
}

const List = (props) => {
  return props.array.map((e) => <div>{`${e.id}: ${e.name}`}</div>
);}

<div>
  <MenuList
    label={'Sort by'}
    placeholder={"Placeholder"}
    defaultFunction={defaultFunc}
    right
  >
    <MenuList.Element value={"name"} fn={stringSortFunc}>Name Name Name</MenuList.Element>
    <MenuList.Element value={"id"} fn={intSortFunc}>Id</MenuList.Element>
  </MenuList>

  <List array={array}></List>  
</div>
```