mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 09:00:06 +00:00
23 lines
455 B
JavaScript
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 };
|
|
}
|
|
|