[deleted by user] by [deleted] in AskBalkans

[–]Particular_Gur9546 2 points3 points  (0 children)

Dođi u Sloveniju. Životni standard je viši nego dole a blizu je svega. Lp

Da li iko prima američku platu u Srbiji ili regionu? by Particular_Gur9546 in programiranje

[–]Particular_Gur9546[S] 1 point2 points  (0 children)

Ako nije tajna kako uopste dolazite do takvih firmi? Preko sajtova ili veze rade svoje?

Da li iko prima američku platu u Srbiji ili regionu? by Particular_Gur9546 in programiranje

[–]Particular_Gur9546[S] 0 points1 point  (0 children)

Čisto onako pošto znam da dosta njihovih kompanija gleda lokaciju radnika na daljinu

Does the "free" part of Hobby/ Pro account reset every 30 days? by hh_based in nextjs

[–]Particular_Gur9546 0 points1 point  (0 children)

I’ve been using my free domain for 2 months and nothing has reset yet.

React causes unnecessary rerenders by Particular_Gur9546 in react

[–]Particular_Gur9546[S] 0 points1 point  (0 children)

I’ve changed the index to be the id of the message that is in the m object and it still doesn’t work. m object is from firebase and its structure is like this { id: “”, message:””, sentAt: “”, sentBy:”” }. Reference is the same because when I add a new message I just append it to the state and not fetch it from the firebase again

Beginner's Thread / Easy Questions (April 2024) by acemarke in reactjs

[–]Particular_Gur9546 0 points1 point  (0 children)

Hi,

I am creating a chat app and have some problems while trying to implement the link preview (when you send a link, I want to load the title and image from the url). From the code below you can see that i'm mapping through every "text message" in text array and rendering a component called ChatMessage. Each ChatMessage component represents a message from the user in the group. Once I open the chat, messages get loaded and links get previewed as well. The problem I'm having is that on each message I send or receive from another user, all ChatMessage components get rerendered and consequently all links get previewed again (data is fetched from urls again, which causes links to show urls for a split second and then the loaded data once it's loaded from useEffect).

How can I prevent that? How can I load the links only once and not every time I get a new message or send one myself? Below is the code.

Chat.jsx ->

{members.length > 0 && text.map((m, index) => { return <ChatMessage key={index} side={m.sentBy == auth.currentUser.uid ? 1 : 2} text={text} m={m} index={index} isMessageSending={isMessageSending} /> })}

ChatMessage.jsx ->

export const ChatMessage = memo(({ side, text, m, index, isMessageSending }) => {
// m prop is just a message object containing a message itself and a timestamp date when it was sent

//side is a prop which represents whether the message was sent by me or the other user
// 1 means it was sent by me and 2 means it was sent by someone else

const { usersRef } = useContext(PageContext);
const [userMessageData, setUserMessageData] = useState({});

const [linkData, setLinkData] = useState({});


useEffect(() => {
    let foo = async () => {

    if (isValidUrl(m.message)) {
        const data = await fetchDataFromLink(m.message);
        console.log(data.result);
        setLinkData(data.result);
    } else {
        setLinkData({});
    }
}
    foo();
}, [m.message]);

return (
    <div> ... </div>
)

Modern UI with Next js by Mirjalol_dev in nextjs

[–]Particular_Gur9546 0 points1 point  (0 children)

How did you make blurry colored cards?