What is the meaning of Matthew 2:21-22?

21 And he arose, and took the young child and his mother, and came into the land of Israel. 22 But when he heard that Archelaus did reign in Judaea in the room of his father Herod, he was afraid to go thither: notwithstanding, being warned of God in a dream, he turned aside into the parts of Galilee: (Matthew 2:21-22 KJV)

William Burkitt’s New Testament Commentary

Observe here, 1. The just fear that Joseph has upon his mind, that Herod’s son would be as bloody a tyrant as his flagitious father. No wonder that the children of cruel persecutors are suspected to tread in their bloody parents’ steps.

Observe, 2. How God’s warrant and direction doth quiet Joseph’s mind, resolve his doubts, and remove his fears, and make him readily comply with the command of God; Being warned of God he removes out of Egypt into Gallilee.

O how safe and satisfactory is it, in all our ways, to follow the call and comand of God! Joseph and Mary durst not move their feet, no not out of Egypt itself, till God gives them a warrant for their departure, and bids them go.