tl;dr: don't chase/be needy, overreact, call it out, be empathetic, have a life
depending on your ultimate goal (get relationship, keep relationship, sex, situationship, friends, etc) it's gonna differ a little but the main things are the same.
don't react overly emotionally to it if you react emotionally at all, stay calm.
'don't react respond' is what my uncle always said. sometimes its best to just call it out 'why the attitude' (though you need to be observant, maybe shes having a bad day, maybe foid issues, stress, etc)
being needy or letting her attitude control/affect yours, it's a visceral turn off. once i saw this guy have a tantrum in front of his gf bc some other girl said something, i watched the love drain from her eyes.
if it's nothing big, you can use light humor to break the tension. if it's too much set boundaries or walk away,
sometimes they'll test your boundaries to see if you'll put up with it. never put up with bullshit, but don't overreact. the more neediness. but don't perform nonneediness, 'just have a life bro' is unironically great advice for this. if all you do is sit around all day she can sense that you have nothing going on.
the second you show her she has control over . but beware, this may turn you into a hyperaware autist who can never fully trust in a relationshp.