π 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:
- π Day One: Fresh React app + AIOHA integration!
- π§ Day Two: Routing drama & rebellious NavBar π€
- π οΈ Day Three: Fixed Layouts, Routing & AIOHA π₯
- Today is Day Four π
π― Today's Goals
- Learn to integrate
.env
in React project π - Implement first
useState
ποΈ - Try out
useEffect
(and totally freak out a little) π΅ - Share Distriator project updates π
π How to Load .env
Values in React (Vite-based)
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
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 valuesetBusinesses
: to update the state
Simple & elegant π
π How to Use useEffect
(AKA: βWhy is my API Calling TWICE?!β)
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 π
π― Removing StrictMode
is a fix...
But letβs be real β not the best one!
Turns out, the smarter way is to use AbortController to clean up async functions.
And yeah... itβs a bit 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 π
βοΈ 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
- I asked ChatGPT/AI to help optimize this post to make it more readable and viewer-friendly.
- Here is the link where you can find both original content & improvements made by AI
- https://chatgpt.com/share/6888bbac-21dc-8000-ba70-26940b53cfe7
π 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)
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 πππππππππ
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 ππππππ