typescript——类型为“Blob”的参数不能分配给类型为“SetStateAction<typeof import(“buffer”)>”的参数
发布时间:2022-03-31 18:48:31 459
相关标签:
我正在努力设定一个目标Blob
使用时的价值useState(Blob)
它不起作用了--
试图使用null
或String
或者干脆不填,这是同一个问题。
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' */
}
};
有什么想法吗?
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报