0

My question is : is there any consequences in performance if using for example:

import * as Reanimated from 'react-native-reanimated'

Instead of :

import { useSharedValue, useAnimatedStyle, withspring, interpolate, Extrapolate } from 'react-native-reanimated'

Will react load all the library when using namespace ? Is there any différence when testing in thé two approaches ?

1
  • It doesn't matter enough to worry Commented Sep 28, 2022 at 9:29

1 Answer 1

1

Import on-demand individual components or utils:

Here is the example of antd

Example:

import Button from 'antd/es/button'; 
import { Button } from 'antd'; // Imports all library

Here is another example of lodash. Only load required utils.

Example:

import assignIn from 'lodash/assignin';
import isPlainObject from 'lodash/isplainobject';
import isFunction from 'lodash/isfunction';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.