In a medium saucepan, combine the fruit of your choice, lemon juice, and a pinch of salt. If using cornstarch, whisk it with water in a separate small bowl and set aside.
Bring the mixture to a boil over medium-high heat, stirring occasionally. This will take about 5 minutes for fresh fruit or 10 minutes for frozen fruit.
Once boiling, reduce the heat to medium. Mash the fruit with a potato masher or fork until it reaches your desired consistency. If using, stir in the cornstarch slurry now.
Add sugar and mix. Continue simmering, stirring often, until the compote has condensed to about half of its original volume and is thick, about 5-7 minutes. If using cornstarch, it will thicken quickly.
Remove the compote from the heat and mash it some more with the back of a spoon or fork for a smoother consistency.
Let the compote cool for a few minutes before serving. It will thicken further as it cools.