Scripture tells us that God closed Hannah‘s womb. But Hannah‘s desire became so strong that she promised that, if God would grant her a child, she would surrender him to Yahweh. God answered her plea. In response, she indeed dedicated Samuel to the LORD and hand him over to Eli the priest (1 Sam.1:5, 11, 28).
We see that it was Yahweh, not Samuel, who has the ultimate foundation of heart joy and strength. For Hannah, there was no one like the Lord. Safety, comfort, and justice are found in him.
There is none holy as the LORD: for there is none beside thee: neither is there any rock like our God. - 1 Sam.2:2