NA
Size: a a a
NA
M
ДК
NA
A
ДК
A
NA
NA
ДК
ДК
AO
AO
ДК
AO
AO
ДК
AO
ES
Font.register({ family: 'Roboto', src: 'https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap' });
const styles = StyleSheet.create({
page: {
fontFamily: 'Roboto',
fontWeight: 'thin',
flexDirection: 'row',
backgroundColor: '#E4E4E4'
},
section: {
margin: 10,
padding: 10,
flexGrow: 1
}
});
const MyDocument = (
<Document>
<Page size="A4" style={styles.page}>
<View style={styles.section}>
<Text>Сессия #1</Text>
</View>
<View style={styles.section}>
<Text>Сессия #2</Text>
</View>
</Page>
</Document>
);
const [instance, updateInstance] = usePDF({ document: MyDocument });
return(
<a href={instance.url} download="test.pdf">
Download
</a>
);
VC
const useFormPersist = (key) => {
const getValue = useCallback(() => {
try {
if (typeof localStorage !== "undefined") {
const persistValue = JSON.parse((localStorage.getItem(key)));
localStorage.removeItem(key);
return persistValue;
}
} catch {
return null;
}
}, [key]);
const setValue = useCallback((value) => {
try {
if (typeof localStorage !== "undefined") {
localStorage.setItem(key, JSON.stringify(value));
}
} catch {}
}, [key]);
return [getValue, setValue];
};