I added a link to this question on stackoverflow.
You can help me? It doesn't seem difficult for those who understand rust. I'm new and I've been in pain for days
I wish I could help you more, but I have no experience with SWC whatsoever and their documentation is not very beginner friendly IMO. I assume you still want to parse the attribute value from an attribute like this: <div background="red"></div>, right? (Based on this question you asked about swc before). From how I understand JSXAttrValue's variants, it seems to me like "red" would be encoded in the ast in a JSXAttrValue::Lit variant. I think you could extract it with a match statement resembling something like:
fn visit_mut_jsx_attr_value(&mut self, n: &mut JSXAttrValue){
dbg!(n);
match n {
JSXAttrValue::Lit(Lit::Str(Str { value, ... })) => {
if value == Atom::from("red") {
println!("yehy, we found red!");
}
}
_ => println!("attribute is not a string literal"),
}
}
Note that this is purely guesswork from staring at the (not too well documented) API docs. I hope dbg!(n) will print the variant you have to match and you can take it from there...