databag/app/mobile/src/session/conversation/addTopic/imageFile/useImageFile.hook.js

23 lines
455 B
JavaScript

import { useState, useRef, useEffect, useContext } from 'react';
import { ConversationContext } from 'context/ConversationContext';
export function useImageFile() {
const [state, setState] = useState({
ratio: 1,
});
const updateState = (value) => {
setState((s) => ({ ...s, ...value }));
}
const actions = {
setInfo: (width, height) => {
updateState({ ratio: width / height });
},
};
return { state, actions };
}