Skip to main content

SlashLogs

Tag: react native

How to create a private component library

How to create a private react component library. While developping apps a some of our code can, and should be, shared between apps, so we can learn once and perfect it in other deployments and so use it more. Copy and paste is an option, but rapidly it will be a headache to mantain and track where did you use it when you need to update something. With that in mind the best is to have a place to store your shared code and have the apps pulling those components when they need it.

How to inject authorization header on all axios requests

While using a frontend client like React you often find yourself calling the backend and using the same code to give axios a JsonWebToken or an Api Key to authorize the client and fulfill the request in the backend code. Instead of passing the authorization token you can handle and instruct axios to save you from that boilerplate code. Axios is a very usefull http client library that can make a lot for us.