In Don't Starve: Shipwrecked you can collect coconuts by chopping down palm trees on the beach. Coconuts can be used as food so you don't starve or they can be replanted. To eat a coconut you need to cut it in half. You can do this by dropping it from your inventory then equipping (after you build it) the machete. Tap and hold the coconut you dropped, then select the cut option. Now you can eat both coconut halves.
How do I open coconuts in Don't Starve: Shipwrecked?