---
title: "Comment by Omprakash Sridharan on \"How do I build a dynamic dependent select form using react+redux, as we are receiving data from backend API?\" | Hashnode"
description: "You can use javascript&#39;s compute property capabilities. Let&#39;s say you want to dynamically select the district based on the state. Construct a json descr"
url: "https://hashnode.com/posts/how-do-i-build-a-dynamic-dependent-select-form-using-reactredux-as-we-are-receiving-data-from-backend-api/5dce4d9f2bd452a26a21547e/comment/5dd0e5848e84d69d6afc7d3b"
---

[Discussion](https://hashnode.com/posts/how-do-i-build-a-dynamic-dependent-select-form-using-reactredux-as-we-are-receiving-data-from-backend-api/5dce4d9f2bd452a26a21547e)

Comment [How do I build a dynamic dependent select form using react+redux, as we are receiving data from backend API?](https://hashnode.com/posts/how-do-i-build-a-dynamic-dependent-select-form-using-reactredux-as-we-are-receiving-data-from-backend-api/5dce4d9f2bd452a26a21547e)

[Omprakash Sridharan](https://hashnode.com/@omprakashsridharan)

[Nov 17, 2019](https://hashnode.com/posts/how-do-i-build-a-dynamic-dependent-select-form-using-reactredux-as-we-are-receiving-data-from-backend-api/5dce4d9f2bd452a26a21547e/comment/5dd0e5848e84d69d6afc7d3b)

You can use javascript's compute property capabilities. Let's say you want to dynamically select the district based on the state. Construct a json describing your conditions.

```
[
  {
    "fieldName":"state",
    "dependentOn":null
  },
{
    "fieldName":"district",
    "dependentOn":"state" //this name should be same as that of mapStateToProps
  },
{
    "fieldName":"city",
    "dependentOn":"district"
  },
]
```

Iterate over the above to create react elements and for each you can access the values using selectors. ex:

```
const getDistrictsByState = (currentState) => {
  return (state)=>state[currentState] //computed at runtime
}
```

Hope this gives you some idea :)
