I love coding and what motivates me is problem-solving and preferably if it has an element of creativity.
I am a self-taught developer and work full-time as a front-end developer.
Location
Denmark 🇩🇰
Education
Bachelor in Nutrition and health (I know not super relevant to my current line of work!)
It's a really nice trick to have the context provider in the gatsby-browser file!
I usually just wrap the other components in the layout file, but it's better to keep the logic in a seperate file, I like that solution 😊
It's also worth noting that if you do not use class components you do not really need the consumer component at all. You simply wrap the root with the provider and then get the context values using the context hook as you have already shown. This is actually quite clever 😊
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's a really nice trick to have the context provider in the gatsby-browser file!
I usually just wrap the other components in the layout file, but it's better to keep the logic in a seperate file, I like that solution 😊
It's also worth noting that if you do not use class components you do not really need the consumer component at all. You simply wrap the root with the provider and then get the context values using the context hook as you have already shown. This is actually quite clever 😊