mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-08 04:40:20 +00:00
Added Render component in UI folder
This commit is contained in:
1 parent
54e73d32e0
commit
2e05fc9d6d
2 files changed
+26
-1
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user