Traps are craftable using 6 grass and 2 twigs, under the survival tab. Baits (food items) can be placed under traps, but is not advisable as it is a waste of precious food items, since they are scarce. Instead, there are other ways to trap your prey without the use of bait. Any form of trigger by animals will cause the trap to fall. When a trap falls, it may successfully catch a creature, or it may also fail, in which you would need to reset it.

a trap with a prey in it

Rabbits
Rabbits give morsels when killed, and 2 rabbits and a twig could be used to craft rabbit earmuffs - a clothing item that can help you keep warm during winter.

Rabbits spawn from rabbit holes. At dusk, or when they are scared, rabbits will run back to their holes. This means that traps can be placed on the rabbit hole itself. When dusk arrives, rabbits will run towards their holes and trigger the trap.

Similarly, you can place a trap on rabbit holes, and scare a nearby rabbit. It will run towards the rabbit hole and trigger the trap. A bait can also be place in line with the trap, so that when a rabbit moves towards to bait, it will trigger the trap since they walk in a straight line to their targets.

However, chasing a rabbit back towards the rabbit hole takes more practice as the direction and position of the player, rabbit and trap all makes a difference. This also applies for putting the bait in line with traps. Hence, the simplest method would be to simply set a number of traps on a number of rabbit holes, as the catch rate can be 100% if you place it right.

Spiders
Spiders give silk, gland, and monster meat which are all very useful items required for making other things. Since spiders are aggressive creatures, it is often troublesome to fight them since they will attack you.

The use of traps enables you to safely and easily farm all these drops from spiders without the need to risk your health.

All you need to do is make a few traps, don't even need any food bait for this. To help you gauge, if the spider den you are trying to farm from is tier 1, 1 trap is sufficient; if its tier 2, then make 2 traps; and so on. This is because when u go near the spider den, the number of spiders that emerge each time depends on the level of the spider den. If it is at tier 2, 2 spiders will emerge when u go near the den.

The moment u go near (on the sticky surface around the spider den), spiders emerge and will chase you. As you walk away from the den, place a trap in your path (or have it placed before hand, either way is fine) and walk through the trap. Spiders will chase you in a straight line and will trigger the traps in their path.

Simply collect the sprung traps to obtain whatever loot that was supposed to drop if you would've killed the spider. This ensures an easy and efficient way to farming silk and glands without having to put on any armor, weapons, or risk hurting yourself.