Added Render component in UI folder

This commit is contained in:
bobbert committed 2025-10-25 22:15:08 +01:00
1 parent 54e73d32e0
commit 2e05fc9d6d
2 files changed
+26 -1

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { useRef } from "react";
import { Text, StyleSheet } from "react-native";
const RenderCount = ({backgroundColor = 'dodgerblue', fontColor = 'white'}) => {
// Initialisation -------------
// State ----------------------
const renderCount = useRef(0);
renderCount.current += 1;
// Handlers -------------------
// View -----------------------
return (
<Text style={[styles.count, { backgroundColor, color: fontColor}]}>
Number of renders: {renderCount.current}
</Text>
);
};
const styles = StyleSheet.create({
count: {
padding: 5,
},
});
export default RenderCount;