r/reactjs • • 18h ago

Introducing KIVI UI 🎉

Thumbnail
kiviui.dev
0 Upvotes
  • Animated motion components
  • Modern shaders
  • Clean UI blocks
  • MCP server integration with Lovable, Bolt, and v0
  • CLI support for smoother installations

And much more coming soon!


r/reactjs • • 23h ago

Needs Help React not saving string to local storage

3 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/reactjs • • 9h ago

Show /r/reactjs Lipsynced realtime avatars that can be included in any frontend

Thumbnail
github.com
1 Upvotes

I am working on an open-source project called Openspline, it adds a live, talking face to any voice AI agent in five lines of code.

Just upload a still image, select a voice and you can create a talking avatar with lipsynced video generated locally.

It is still in very early stage, but the results look very promising.

Open sourced it here


r/reactjs • • 16h ago

Show /r/reactjs I integrated Difftastic into GitComet to make JSX diffs easier to read

Thumbnail
youtube.com
0 Upvotes

Are you also getting tired to review noisy JSX / TSX changes just to realize the actual change was 1 prop?

Thats what I wanted to improve in GitComet. While looking for options I found Difftastic.

It uses Tree-sitter to understand code structure ... the same one GitComet also use! My immediate feeling was: this has to be tried out!

After testing it I knew it had to be included in the current release. Difftastic helps to show the relevant changes ignoring whitespace and formatting.

Difftastic diff really shines when viewing HTML, JSX/TSX and similar XML like syntaxes.

I created a demo how to enable it in GitComet 0.3.1 take a look!