Skip to content

Tag: reactjs

How to display an image from a string in react

I have featured_image that i get from an axios call, the image is saved in the src folder, src/img. It’s a string and it’s equal to “../img/blog1.jpg”. I can’t have the background image dispalyed i believe it needs to be converted to a static image somehow. Answer If you are usin…

Why Gun.js duplicate messages in ReactJs

I’m implementing gun.js in react application.But messages are duplicated on each render, and on each update. Can someone help to figure out what’s wrong with my code. this my code . then in my component : get message on each new update send message function Answer My simple fix for that was add us…

Trigger parent API call from child in react

In my parent(Feed) I display a list of posts: The child(PostCompose) can create a post: The PostCompose component makes the requests to the backend to create the new posts, but how do I trigger the Feed to refresh to pull the new list of posts? I feel like my approach might need some work, any help would be g…

REACT- My condition is working partially why?

In my json file from my api, I have a variable apply, If apply:0, Then It should should print my data and If apply:1, Then It should hide my data (i.e row in my Table). Actually when I combine my 2 conditions, It is partially working :(applyStatus ? menus : menus.filter((i) => i.apply !== 1)) && (s…