3

I have React Native app with TypeScript and MobX. Recently I have found an article about StyleSheet.create https://stackoverflow.com/a/52994858/10106073, that in the current React application there is no difference between:

const styles = StyleSheet.create({
  container: {
    flex: '1',
    alignItems: 'center',
    justifyContent: 'center,
  },
  text: {
    color: 'red',
  },
});
const styles = {
  container: {
    flex: '1',
    alignItems: 'center',
    justifyContent: 'center,
  },
  text: {
    color: 'red',
  },
};

And i know that declaration (creation) objects in the render - this does not really add a lot of memory. It just creates a new link that just points to the same block of memory, which is pretty efficient. But if the value in the object changes, a new block of memory is created, here you already need to think about optimization. I'm really interested how can i check it, and the performance of my app. Can somebody recommend how can i do it?

jocoders
  • 1,594
  • 2
  • 19
  • 54

0 Answers0