I have a React component, but the raw string:
<MyComponent id={123} value={345} name="Thomas" />
How can I regex through this string and extract all props & their value?
{
id: 123,
value: 345,
name: "Thomas"
}
I am struggling to understand how to go about something like this.
I've tried things like this, but they aren't really getting me anywhere... :
let res = myComp.match(/.*<MyComponent id={.*/g)
let value = res[0].split('{')[1].split('}')[0]