Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Argument of type 'Blob' is not assignable to parameter of type 'SetStateAction'

$
0
0

I am trying to set a Blob value when using useState(Blob) it's not working -,-

Tried to use null or String or just leave it blank, It is the same issue.

import * as ImagePicker from 'expo-image-picker';import Blob from 'buffer';const [uploaded, setUploaded] = useState(false);const [video, setVideo] = useState(Blob);const uploadMedia = async () => {  if (uploaded) return;  let result = await ImagePicker.launchImageLibraryAsync({    mediaTypes: ImagePicker.MediaTypeOptions.Videos,    allowsEditing: true,    aspect: [4, 3],    quality: 0,  });  if (!result.cancelled) {    const response = await fetch(result.uri);    const blob = await response.blob();    setVideo(blob); /* < Argument of type 'Blob' is not assignable to                     parameter of type 'SetStateAction<typeof import("buffer")>' */  }};

Any ideas?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>