Saving a JSON Object string in State variable ! #7860
poirazis
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Did you know, you can save a whole JSON string in a State variable and then treat is as such ?
using the JS binding, you can set a State variable name State.selectedDistrict to contain
return { "id": $("rptDistrictRow.district.id") , "name": $("rptDistrictRow.district.name") }
then, you can reference the above variable with HBS as {{ State.selectedDistrict.id }} and {{ State.selectedDistrict.name }}
you can use this approach to keep your State variables better organized, better maintainable and better understood.
I don't know if you guys knew and used this, but i found it today and wanted to share !
Beta Was this translation helpful? Give feedback.
All reactions