You are viewing a single comment's thread from:

RE: 2024-04-13 - How to upload an image to Hive Post?

in HiveDevslast month
// this one to call external APIs
<script  src="https://unpkg.com/axios/dist/axios.min.js"></script>

I would HIGHLY recommend using fetch over axios unless you need interceptors. You are loading another 16kb of data which does the same thing as a fetch but without needing to grab that 16kb.

Also if you are going to use axios, lock it to a specific version rather than using the latest, you never know when a breaking change is going to come around and break stuff.

Sort:  

Thank you @rishi556 for checking out my post & adding a comment.

Let me reward you back with !ALIVE token

@rishi556! You Are Alive so I just staked 0.1 $ALIVE to your account on behalf of @ sagarkothari88. (8/10)

The tip has been paid for by the We Are Alive Tribe through the earnings on @alive.chat, feel free to swing by our daily chat any time you want, plus you can win Hive Power (2x 50 HP) and Alive Power (2x 500 AP) delegations (4 weeks), and Ecency Points (4x 50 EP), in our chat every day.

Understood. Thanks for pointing it out. Initially I used fetch.
Then I thought of other devs who usually prefers axios (which includes me too :P)

I'll update it fetch. Also, any idea why code formatting isn't showing up correctly?
I remember adding perfect indentation - spacing - all gone :(

No idea on the code formatting, I thought it was strange too, maybe copy paste stuff?

Yeah, I used to use axios a ton myself too but have been moving my stuff over, especially now that it’s built into Node.JS too. I’ve been heavily working on UI stuff at work and so bundle size has become a huge concern to me.

Understood. Thank you for sharing your experience. I'll take a note of it & update code accordingly.

I'm 100% sure that, even after hitting the publish button, everything looked good & right after publishing, everything f**ked up. Let me try editing it from peakd.

Edited the post on Peakd & now it works fine.