Day 4 ReactJS Adventures + Distriator Progress: useState, useEffect, and .env Chaos 😹

By sagarkothari88 on 7/30/2025

πŸ‘‹ Hello Hive Community!

Another day, another ReactJS rollercoaster! 🎒
We've been deep-diving into ReactJS while pushing progress on Project Distriator and CheckInWithXYZ πŸ’ͺ

Let’s rewind βͺ what we’ve covered so far:


🎯 Today's Goals

  1. Learn to integrate .env in React project πŸ”
  2. Implement first useState πŸŽ›οΈ
  3. Try out useEffect (and totally freak out a little) 😡
  4. Share Distriator project updates πŸ“ˆ

πŸ”‘ How to Load .env Values in React (Vite-based)

dot env reference image

If you're using Vite + React like us, it's super simple πŸ‘‡

πŸ—‚οΈ Step 1: Create a .env file
πŸ›‘ Don’t forget to put it inside .gitignore

✨ Prefix all variables with VITE_, like:

VITE_API_KEY=some_key_here

πŸ”“ Access it in your app like this:

import.meta.env.VITE_API_KEY

πŸ”„ How to Use useState

setState example image

useState lets you track and update values inside functional components πŸ“¦

βœ… Step 1: Import it

import { useState } from "react";

βœ… Step 2: Declare a variable

const [businesses, setBusinesses] = useState([]);

In Distriator, we're tracking a list of businesses – so we start with an empty array.

  • businesses: current value
  • setBusinesses: to update the state

Simple & elegant 😎


πŸŒ€ How to Use useEffect (AKA: β€œWhy is my API Calling TWICE?!”)

useEffect Reference image

Okay... so this one had me like πŸ˜΅β€πŸ’«
I initially wrote:

useEffect(() => {
  const fetchedData = async () => {
    // some logic to fetch businesses
  }
  fetchedData();
});

πŸ’£ Result: Infinite reload loop! App was like: "I LIVE TO FETCH!"
I panicked, closed the app, went into full bug-hunting mode πŸ•΅οΈ

🧠 The Fix?

I forgot the dependency array []

useEffect(() => {
  const fetchedData = async () => {
    // some logic to fetch businesses
  }
  fetchedData();
}, []); // Important!

But even then... API was hit twice πŸ˜‘

Two times API calls

Screenshot 2025-07-29 at 5.43.52β€―AM.png

🎯 Removing StrictMode is a fix...
But let’s be real – not the best one!

controller

Turns out, the smarter way is to use AbortController to clean up async functions.

And yeah... it’s a bit weird. πŸ‘‡

weird

Let’s move on before I rage-quit πŸ™ƒ


🏨 Distriator Project Updates

Big win on Distriator today! πŸŽ‰
We’ve successfully integrated all rooms of Ati Hotel πŸ›οΈ
Deployment is live at: alpha.distriator.com πŸš€

Distriator Changes

☝️ Screenshot above highlights just one file’s worth of changes, but the impact is massive!

Tagging @ecoinstant & @starkerz so you guys can start playing around on the alpha site!


πŸ™ Thanks for Following Along!

I’ll be back soon with more learnings, bugs, laughs & updates.
Until then β€” keep building, keep shipping! πŸ’»βœ¨

See you in the next post! πŸš€


πŸ“ Final Note


πŸš€ My Contributions to ♦️ Hive Ecosystem

Contribution To Hive Ecosystem
Hive Witness Node Hive API Node (in progress) 3Speak Video Encoder Node Operator (highest number of nodes) 3Speak Mobile App Developer
3Speak Podcast App Developer 3Speak Shorts App Developer 3Speak Support & Maintenance Team Distriator Developer
CheckinWithXYZ Hive Inbox HiFind Hive Donate App
Contributed to HiveAuth Mobile App Ecency ↔ 3Speak Integration Ecency ↔ InLeo Integration Ecency ↔ Actifit Integration
Hive Stats App Vote for Witness App HiveFlutterKit New 3Speak App

πŸ™Œ Support Back

❀️ Appreciate my work? Consider supporting @threespeak & @sagarkothari88! ❀️

Vote For Witness
sagarkothari88 @sagarkothari88
threespeak @threespeak

Comments (2)

kgakakillerg's avatar @kgakakillerg 7/30/2025

Blocktrades can you please stop downvoting my original content with your alt accounts thanks πŸ™πŸΎ

πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Don't be jealous So sad @themarkymark aka @theycallmemarky Aka @marky @gogreenbuddy Aka @usainvote @buildawhale Aka @punkteam Aka @ipromote

@letusbuyhive Aka @sagarkothari88 please explain why you keep downvoting my original content and comments πŸ€”

Please explain to everyone why πŸ€”

@meno @steevc @crimsonclad @azircon let's not forget blocktrades πŸ˜‚ please tell your racist friend to stop downvoting my original content

How can we we allow a mentally ill person to have so much control on Hive πŸ˜‚

It's unbelievable you downvoted this Goodbye Auntie R.I.P πŸ™πŸΎ You fucked up big time it's clear blocktrades is in control πŸ˜‚

If nothing can be done about your downvote abuse then Hive is a dead project πŸ‘ŽπŸΎ

It's crazy that the person doing the downvoting is also farming the shit out of Hive πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

If anyone wants to speak to me privately send me a message on Instagram @kgakakillerg

You can never stop the truth with lies πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

It's crazy we have a man who pretends to be a millionaire running around Hive downvoting people for fun πŸ€” and nothing has been done πŸ€”

It's crazy that someone is trying to bully me on Hive πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

It's unbelievable that no one has came to help as people are afraid to say anything or they get downvoted too πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

There's no real freedom on Hive if one person can cause so much harm

I feel sorry for you πŸ™πŸΎ

One thing you need to remember you can't take anything with you πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Go and enjoy your life have a bit of fun let your hair down go out and meet some real people in the flesh πŸ˜‰

Your actions show that you must own Hive Blockchain πŸ€” why do your actions go unchallenged πŸ€”

You are now stalking me πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Are you jealous about the DHF πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Aren't you farming enough rewards πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

I heard you were into very young girls πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Is that why you are always online πŸ€”

Stalking people

No one is scared of you πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

You are bad for Hive

Power down and go away get a life

https://hive.blog/hive-135178/@crimsonclad/re-kgakakillerg-sxllhv

https://hive.blog/hive-148441/@hivewatchers/svftu9

https://hive.blog/hive-148441/@hivewatchers/svdjjz

https://hive.blog/hive-176853/@steevc/re-kgakakillerg-syyy4x

https://hive.blog/dev/@howo/re-kgakakillerg-szhax7

It's unbelievable that they downvoted this Goodbye Auntie R.I.P πŸ™πŸΎ

It's clear you need help πŸ™πŸΎ

Hive is being held down by downvoting whales

Do you get a buzz out of downvoting people πŸ€”

You should really try to get outside more spend some time in the real world 🌎🌍

Why are you pushing people away to blurt and steemit

You are all definitely going to hell πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Why do you want to make enemies all over the world πŸ€”

Blocktrades stop making a fool of yourself πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Steevc please explain to your friend they have been exposed πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Downvotes are weak like you πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Why don't you go and spend your millions of dollar's you have πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Blocktrades please explain why you keep downvoting my original content with your alt accounts πŸ€”

You are so sad it's unreal πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

You must know that you can't hide on Hive πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

If you want everyone to leave Hive keep doing what you are doing πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Just remembered who started this

I'll be here to turn the lights off πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

You are still stalking me πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚ it proves you have no life outside of Hive πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ‘ŽπŸΎπŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Blocktrades please can you stop downvoting my original content with your alt accounts πŸ€”

Also is bullying people ok on Hive πŸ€”

You are only making Hive look like a big scam

Why do you keep stalking me I'm not gay sorry I can't help you πŸ™πŸΎ

Just tell me what the issue is πŸ€”

You are that stupid you set up an account called letusbuyhive to downvote people and support your farming Hive friend's πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚ and @buildawhale

Please get some help πŸ™πŸΎ

It's clear who has mental health issues that's why you should really stop pointing fingers at others πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

It's clear blocktrades is behind this πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Can you please explain why you keep downvoting my original content I don't want to hear it's because disagreement of rewards I don't make any πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Please move on with your life blocktrades and leave me alone thank you πŸ™πŸΎ

Please tell everyone why you keep downvoting my original content πŸ€”

Still stalking me πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

The way you are stalking me it's clear you have no Life outside of Hive πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Keep downvoting people away πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Some people never learn πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ€£πŸ€£πŸ€£πŸ€£πŸ€£

Is life that bad πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

You can't win this πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

kgakakillerg's avatar @kgakakillerg 7/30/2025

Are you really that stupid you have been exposed turn off @letusbuyhive and tell your friend's to turn off there downvoting bots

You people are only making Hive look like a big scam πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚