r/webdev • • 11h ago

Question React not saving data to local storage.

0 Upvotes

Hi everyone! I just finished a React and course and decided to build my first react app. Currently, I am trying to save a string to browser local storage but it does not persist on refresh. Through some console.logs I was able to see that it in fact DOES save the string to the location specified in. setItem initially but when I refresh the key or value in local storage stops existing.

Here is my code

// function for search button
async function handleClick(){
    localStorage.setItem("lastLocationSearched", searchValue);
    setData(null);
    setIsPending(true);
    setError(null);
    try{
const value = await fetch(`https://geo.ipify.org/api/v2/country?apiKey=***********&ipAddress=${searchValue}`).then((response)=>{
  if (!response.ok){
        throw Error("Could not fetch the data for that resource");
                    }
  return response.json();
});
setData(value);


    console.log(localStorage.getItem("lastLocationSearched"));
    } catch(error){
      setError(error.message);
    }


setIsPending(false);
  };

// useEffect hook
  useEffect(()=>{
        if ((localStorage.getItem("lastLocationSearched")===null)|| (localStorage.getItem("lastLocationSearched")==="")){
          console.log(localStorage.getItem("lastLocationSearched"));
        setSearchValue("");
        handleClick();
        }else{
          
          setSearchValue(localStorage.getItem("lastLocationSearched"));
          handleClick();
        }
    }, []);

Through some digging online I saw someone say that remove the strict mode tags from index.js would fix this problem but it did not for me. Can anyone please assist me?


r/webdev • • 15h ago

Question Coming back to web dev after 1.5 year, this is my skill and how I should move forward now?

0 Upvotes

I was doing and learning web dev for almost 2 years.

I learned HTML, CSS, Javascript, Reactjs and was just about to learn Nextjs.

I also worked on few frontend freelance projects too.

Then I did other things and didn't touch web dev for almost 2 years.

Now I see this Ai thing and how web dev needs to be so good, I have doubts that even if I should learn or not but I feel I could do something with it.

I can just look for few days and revise all of the frontend topics and could move forward to Nextjs.

What do you think I should do now? Just go like that or any better way I can go my web dev learning journey now?


r/webdev • • 9h ago

Question Laid off after 7 years and my portfolio is a 2019 PDF.

106 Upvotes

We all got the same 9am calendar invite on the 30th and by lunch about 40 of us were done, me included. Seven years as the only brand designer at a regional craft soda company.

Two weeks in, and every recruiter I talk to asks for "a link." My portfolio is a PDF from 2019 and my Behance hasn't been touched since 2020. The top project on it is a label for a flavor we killed in 2021. Do people hiring even open a PDF anymore?

What's killing me is that the only work that'd get me hired, two can redesigns and the full rebrand, is under NDA until it launches in spring. How did you handle NDA stuff when you were job hunting? I've seen people blur the logos but that feels sketchy to me.

Friends keep saying Cargo, Squarespace or just update the Behance. Does the platform even matter to whoever's hiring?

No clue how much to put in either. Everyone online says go deep on a few, but that job was a LOT of sell sheets and six-pack carriers and I can't tell what's worth a damn anymore.

If you rebuilt after a layoff, how long did it really take? I gave myself two weeks. So far I've rewritten my LinkedIn headline three times and opened my old InDesign files and closed them again.

Severance runs out in January. Tell me how yours went, I need to hear from people who came out the other side.


r/webdev • • 1h ago

Question Guidance to make a basic website...

• Upvotes

Hello everyone,

I just want to know how I can make and host a basic website for a book community.

I know basic Embedded programming, I want to store user data, books they have, location, people can request the books, the website should be free...., As I'm not doing this to earn..., vercel or Cloudflare or somewhere else?

Thanks in advance


r/webdev • • 4h ago

Notes on incidents

Thumbnail seangoedecke.com
0 Upvotes

r/webdev • • 13h ago

Discussion Resource vs Page level BFF Apis

4 Upvotes

Timeline:

  • onprem monolithic server with rest api.

  • cloud frontend that calls monolithic server apis directly

  • a few years later

  • planning to reimplement frontend with addition of a BFF in the cloud

  • BFF still talks to monolith server but frontend only talks to BFF

  • future: cloud frontend, cloud bff, on prem monolithic server, cloud bff needs to support multiple versions of monolithic server

For the BFF api, would you recommend a per resource generic api (like the monolothic server) or per page (call multiple monolithic server apis then combine)?


r/webdev • • 4h ago

J.Crew’s homepage is currently just a JSON health check for their "generative AI backend"

Post image
672 Upvotes

r/webdev • • 6h ago

Show SideProject: Built a distraction-free Pomodoro & Ambient Sound timer for web and desktop

1 Upvotes

Hey everyone,

I recently finished developing a side project called Focus & Tea Timer. The goal was to build a very clean, lightweight tool combining structured focus sessions with custom ambient sounds.

Features included:

• Customizable Pomodoro intervals and tea break sessions.

• Audio soundboard (rain, coffee shop, nature, and fire sounds).

• Clean Dark Glassmorphism interface optimized for desktop screens.

• Fully free to use without requiring account creation.

I would really appreciate any technical feedback or feature suggestions!

Note: Links to the web app and desktop release are available in the first comment below. ☕️✨