Özgün Bal
Software Developer, Javascript Enthusiast
@GeekDay 2025
const useSharedHook = (...arguments) => {
const api = useApi()
const form = useForm();
const someHandler = () => {
// Does some stuff
};
return { relevantDataToBeUsedInViews };
};// React.js
const FormPage: FC = () => {
const navigate = useNavigate();
const { data } = useSharedHook();
const handleNavigate = () => {
navigate('/other-page');
};
return (
<div>
<header>Title</header>
{data}
<button onClick={handleNavigate}>
Navigate
</button>
</div>
)
}// React Native
const FormPage: FC = () => {
const { navigate } = useNavigation();
const { data } = useSharedHook();
const handleNavigate = () => {
navigate('/other-page');
};
return (
<View>
<View>Title</View>
{data}
<Button onPress={handleNavigate}>
Navigate
</Button>
</View>
)
}By Özgün Bal