I write them based on what little experience I have with actual children.
Sometimes they have more 'smarts' because the plot requires them to.
Otherwise I write them the way I've seen the (Good executed) ones get written.
I'm struggling to write a character in hound and fox right now because I want her (She's like 10 and most of the characters are grown ups) to have that 'silly brat' energy without being obnoxious.
Same as grown-ups, but I make the font smaller to indicate they're small people...
In all seriousness, I think children are hard to get right for the simple reason that it very much depends on the age of the children. An 8 year old will react very differently from a 10 or a 12 year old. Boy vs girl matters, both from a maturity angle, but also simply how they react to things.
I think to write believable children you need to know even more who you're writing than when writing adults.
When I write children I base them on how my own children and my nieces and nephews were at whatever age I need to write the character at. The challenge is that most readers have children (or child relatives) of their own and so have their own ideas about what children are like. It isn't an easy balance.