Skip to content

Tag: javascript

Wrong React hooks behaviour with event listener

I’m playing around with React Hooks and am facing a problem. It shows the wrong state when I’m trying to console log it using a button handled by event listener. CodeSandbox: https://codesandbox.io/s/lrxw1wr97m Click on ‘Add card’ button 2 times In first card, click on Button1 and see …

Length of Array of Objects in JavaScript

I understand that finding the length of a JS object has been answered extensively here With one of the suggested solutions being Object.keys(myObj).length However, I’m struggling to find out how can I find the length of all properties contained on an array of objects. ie: Object.keys(users).length //3 G…

how to store image / video file using gundb?

I know the traditional way is to store image/video file in one place and then just save the reference index into db’s table. Now I am learning about gundb, I can store key-value json type data very easily, but since it is decentralized, if I wanna make a say chatroom app, how should I handle image stori…