I am Working on Admin Panel which has 30-40 Master table which contains CRUD functionality.
There are few masters which I need to call again and again in different masters. Eg we need to call country master in State & City inorder to add State and City because they both should in particular country. So the problem is I have to write or copy paste entire getCountry() Code in State & again in City. In OOPs we used to just create function at once then call it anywhere with single line of code.
But react that's not working as expected. So what's the best way to do that? Hope I am clear here.
Points / My concern
- There are lot of repetition for calling APIs.
- In oops we create function and just call that using single like and use it. But not in react we have to write setState logic and need to handle success, error logic everywhere again and again
I am Working on Admin Panel which has 30-40 Master table which contains CRUD functionality.
There are few masters which I need to call again and again in different masters. Eg we need to call country master in State & City inorder to add State and City because they both should in particular country. So the problem is I have to write or copy paste entire getCountry() Code in State & again in City. In OOPs we used to just create function at once then call it anywhere with single line of code.
But react that's not working as expected. So what's the best way to do that? Hope I am clear here.
Points / My concern