Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

Check dynamically if values are mandatory and then check if the mandatory values are null

$
0
0

I have this object state which I have intialized it as initialSegement

I have created this component when I set the state of every field startDate, endDate etc and all is working fine there.

I want to create this function called validateSegement which will be boolean. If this function returns true, then the button to add a segment will be enabled.

I have created this function, but unfortunately is not dynamic.

The issue is that these fields are configured dynamically by the user if they're mandatory or not. So I want to find a way of doing this by first checking if fields are mandatory and second checking if the mandatory fields are empty or not.

I can find out if the fields are mandatory from a response from the backend, which for this case I will suppose the response is like this:


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>