I am using WebStorm as my IDE. It allows you to use VTL to create templates that you can use to quickly build React components.
I am writing one that created a quick arrow function component. I am almost done, but I am stuck on one part.
WebStorm exposes a variable called $PROP_TYPES. It takes the form of something like this:
{"onClick": "() =>", "isActive": "true", "editing": "false"}
With these being all the props that are passed in to a component.
I need a way to loop through these and get the keys only and save them in this format:
{onClick, isActive, editing}
As these will be the props for the component. The problem is my code is only printing off the first prop and that is it.
Here is my VTL code:
#if($PROP_TYPES) #set($prop = $PROP_TYPES.substring(0, $PROP_TYPES.indexOf(":")).concat("}"))#end
My $prop variable is displaying the wrong thing.