In this section we're going to talk about one last little difference between GSX and HMO.
This last little thing is probably the most important feature to understand about GSX because we're
going to be working with this feature quite a bit throughout this course.
So GSX can very easily reference javascript variables.
Essentially that means we can take a javascript variable and easily printed up inside of our GSX block.
Let's flip back over to our code editor and get a quick example of what this would look like.
All right.
So inside of my app function right here or my app component I'm going to create a new variable.
They're going to call it something like button text and I'll give it the text of click me.
Like so.
So now if we want to we could refer to this button text variable inside of our button in place of just
putting in the plain text of submit to do so I would delete that text of submit and then I'll put in
a set of curly braces like so now the curly braces here are not indicating a javascript object.
Instead the just the curly braces are indicating that I want to reference a javascript variable right
here so I can then type out the name of the variable that I want to insert into this button.
I can then save this file flip back over to my application at local hold three thousand and I'll see
that.
Now that button says Click me.
So with this curly very syntax we can very easily reference different javascript variables inside of
our GSX.
We're not only limited to making very simple statements like this where we define a single variable
at a time and then reference it inside.
We could very easily do something a little bit more complicated for example maybe in front or right
before my app component.
I defined something like say function get button text and then anytime someone calls this function maybe
I will return click on me.
Then inside of my button tag right here.
Rather than referring to button text I can delete that and call the function that we just created.
So I'll say it button text like so make sure you get the parentheses on there so you actually invoke
the function.
The other thing it wants to do is clean up that variable that we're no longer using but in text Revier.
All right let's save this and see how it goes.
I'll flip back over and of course see now see.
It's the button says Click on me as opposed to the Submit or click me that it said before.
Now there's only a couple limitations around what type of variable we can reference inside of these
GSX blocks using these curly braces.
Let me give you a couple of quick examples.
In the next video because this is a problem that you are very likely to run into at some point during
your rehab act career.
So quick pause and I'll see you in just a minute.