Many characters have a backstory and it is usually sad. However I do wonder, when is it that you have to reveal a character's backstory. I've watched some videos of writers explaining how to reveal a backstory and most importantly when we have to reveal it to the audience/readers. And they told me to do it not too long after we meet the character, or mid way-way in the plot. Some also suggested to makemaking them act a certain way or to learn about their motives and intentions then we reveal their backstory. But it is to explain the character's role in the plot
However, when I watched a well written-written show, they showed us a backstory of a character immediately after the character just got hit on the face and before they got sent onto a trial. And I wonder, is there a proper timing and execution to reveal a backstory? I mean, one of the reasons why Demon Slayer is not that good in writing is because of how they reveal the character's backstory right before they die or right when they die.
I asked writers from a Discord server and they say that it depends on the flow of the story, but I'm still confused about it.