James is saying that when the trials of life happen, we need to hold on to God. It’s an opportunity for us to look in the dark for the less obvious blessings and mercies of God that we might overlook in the light. When we do, God shows us things that we otherwise might miss. God’s light is brightest in the dark.