How to counter move 18?

I lose toomany games to this. How do you handle this invasion?

You didnt lose because of move 18. Its very difficult to keep 4th line territory. Even more so on a small board. With a stone on the 4th line you usually get influence as you did which gave you territory in the middle in the end.
That is the key, you have to get something in return!

Your big loss in that game therefore was the upper right corner and right side where you lost everything without getting anything in return.

When an opponent plays in territory you thought was yours, it can be very scary for those starting out, what you have to learn is that invasions are a part of the game; we can make do all we can to prevent them, but that leads to over concentration of your stones.

It’s best just to play as you normally would and make sure to limit the damage as much as possible. As you learn more and improve, you’ll feel more comfortable attempting to actually attack an invasion with the intention to kill.

I agree with what @Kabootle said, try to profit in some way. Your opponent played in the exact middle of your two stones, which was asking “which side do you want?” so you’re best option there was to secure one side, before protecting the other within reason. the result would be a wall facing the middle ( or corner territory, depends on white’s line of play) , essentially blocking off any attack in that direction.

I feel like the biggest thing here is the opening. White gets a lot on the right hand side in the opening, and he can solidify a good 30 points or rather easily at this point, and it’s still early enough in the game to look for invasions and fights for more. Basically, in the opening, white opens with 5-4 stones, which aim heavily at outside influence. you can jump under these stones with a 3-3 or a 3-4 point early on to exchange the influence that he wants for the territory underneath his stones. Josekipedia will have some variations you can look at for that move, but there’s not a ton of simple variations from the 5-4 openings.

it doesn’t show up so much on the small board, but think for a minute.

if you establish a moyo (a loose territorial framework made up out of influence),
its almost never to convert that into direct territory.

what you’re doing is setting up a situation, where if your opponent doesn’t invade,
then you will* get all that territory and they will lose. so you’re really forcing an invasion

why would you force an invasion? because, with all your influence, your opponent
is at a disadvantage. unless you’re certain, don’t chase them around wildly hoping for the kill.

push them against the side, build more walls by attacking them in sente threatening death.

you’re hoping to turn them into a tiny, barely living cyst at the edge of your moyo. after 20 moves, how many points did they make? 2. how many points did you make? the rest of your moyo, which should be at this point all good and sealed up.

in the posted game you could have taken a large upper left, and/or a large lower left, or a smallish middle. your failure was in choosing the smallest of these three options. but even at move 35 things were still even-ish.

the road to victory is coming out a little bit ahead in a few fights. not winning one big fight.