# Default is not working with oneOf and array in React

**URL:** <https://jsonforms.discourse.group/t/default-is-not-working-with-oneof-and-array-in-react/440>\
**Category:** General\
**Created:** [October 18, 2021, 10:02pm UTC](https://jsonforms.discourse.group/t/default-is-not-working-with-oneof-and-array-in-react/440 "2021-10-18T22:02:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RohitChattopadhyay](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/rohitchattopadhyay/32/190_2.png) [@RohitChattopadhyay](https://jsonforms.discourse.group/u/RohitChattopadhyay)\
**Post date:** [October 18, 2021, 10:02pm UTC](https://jsonforms.discourse.group/t/default-is-not-working-with-oneof-and-array-in-react/440/1 "2021-10-18T22:02:34Z")

</div>

```auto
{
  type: "object",
  properties: {
     prop1 : {
       "type": "array",
       "oneOf": [
            { title:"abc", const: [1,2] },
            { title:"def", const: [3,4] },
       ],
      "default" : [3,4]
  }
 }

```

For above, I am not able to set default value,  
I am getting following

> Material-UI: You have provided an out-of-range value `3,4` for the select component.  
> Consider providing a value that matches one of the available options or ‘’.  
> The available values are ``, `1,2`, `3,4`.

Also I want to remove the blank option visible at first in the dropdown select

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [October 19, 2021, 8:23am UTC](https://jsonforms.discourse.group/t/default-is-not-working-with-oneof-and-array-in-react/440/2 "2021-10-19T08:23:34Z")

</div>

Hi @RohitChattopadhyay, for default support you need to hand over a customized AJV instance in which it is enabled, see [this question for more details](https://jsonforms.discourse.group/t/help-with-default-values/31).

At the moment the off-the-shelf renderers always offer the blank option, see [this issue](https://github.com/eclipsesource/jsonforms/issues/1501) for more details.

---

<div class="post-metadata">

**Author:** ![RohitChattopadhyay](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/rohitchattopadhyay/32/190_2.png) [@RohitChattopadhyay](https://jsonforms.discourse.group/u/RohitChattopadhyay)\
**Post date:** [October 19, 2021, 9:34am UTC](https://jsonforms.discourse.group/t/default-is-not-working-with-oneof-and-array-in-react/440/3 "2021-10-19T09:34:09Z")

</div>

Thanks Stefan  
I am using AJV as pointed out by you

The issue I am seeing is, if the `const` of OneOf is an array, default is not working  
In JS , array cannot be compared via `==`, it will always be false even if content are same with same order
