score:1
const {currentuser, } = useauth();
const [imgurl, setimgurl] = usestate([]);
useeffect(() => {
const fetchdata = async () => {
const response = await firebase.firestore().collection("users").doc(currentuser.email).get();
setimgurl(response.imgurl);
};
fetchdata();
}, []);
return (
<>
<img src={imgurl} alt="avatar" class="profile" />
</>
)
fetch the doc and then and get the imgurl and set the value to setimgurl state. pass the imgurl to the img tag.
Source: stackoverflow.com
Related Query
- Retrieving/Handling Image URL From Firestore - React js
- cannot download image from URL react
- react load svg image from url
- Fetch image from URL and set as background in React JS
- When I upload a image firebase storage getdownloadUrl() put download url In Firestore Collections but not set it in React JS
- How can I turn the data that is a image came from API to url to use in img tag in react Js
- React - How to pass image url from data map to component?
- Cannot use/update input value in react hooks which will be added to an image src attribute from a random image generator url
- How do I set a background image from url in React (an outside url not a local file)
- React and Firestore - problem with retrieving the user profile picture URL
- React doesnt load image from url
- Retrieving image from backend using url
- React - Can't fetch image from URL but works in C#
- Retrieve image url from database and display in React using Material-UI
- retrieving data from firestore using uid react
- React Js getting Image from AWS s3 URL
- Retrieving value from <select> with multiple option in React
- Display an image from url in ReactJS
- React Native Image Not Working with specific URL
- Mozilla PDF - how to view PDFs from url in react app?
- React Import SVG inline from URL
- Prevent image from rerendering at every state change - React
- How can I get the image url from IPFS info in React.js?
- handling error response from express to react
- Accessing the URL hostname from React JS
- Remove .html extension from a url for a website built using React and Webpack
- get parameter value from url using React Router
- Set background image url using inline css in react js
- get local image path from json in react
- How to pass image url as prop in React
More Query from same tag
- react state is one state behind button clicks
- Adding ID to ag-grid row
- Array map into string with line break - React
- MUI : disable button conditional
- Why do event handlers not get the right handle to this?
- Rendering ReactJS with CSS
- React + Ionic Video Recording
- Is it possible to write text file then upload to google drive in react?
- Is it possible to use PropTypes to validate Dictionary-like objects?
- Change State of an image based on index of array - React.js
- Parent and child component both have button, when click child button, parent button invoked
- Questions about initializing `useState` with `Date.now()`
- next-dev.js:89 TypeError: Cannot read property 'parentNode' of null
- React Intl Formatting date
- Redux state mutation despite making state copy with spread operator
- reactjs fetch with parameters from cognito
- Creating Generic React Function Component With Type That Ensures Presence of a Property
- GET request after every few seconds
- How to dynamically create a new row?
- React Leaflet -- button on map assistance
- Correct way to set default prop to the first item in prop array
- React children functional props not working
- How can i share data between non-related components in react js?
- Why xState is not working with react redux?
- How to change all value of items in a list in reactJS when onClick on an item
- How to make a React App windows Authentication
- Using redux-form, how can I reset the form values from another component?
- Css - how to make the slide animation change direction
- React ref.current is null in componentDidMount only in Enzyme test, NOT null in real time
- Create a loading animation that works in react