how to check data type in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To check data type in react native, use typeof keyword it will return type of data just we have to use this keyword before variable or data. Let’s see short example to use typeof to get data type of value. typeof "Hello"; Today, I’m going to show you How do I check data type in react native, as above mentioned, I’m going to use the above-mentioned typeof method....

September 8, 2022 · 1 min · Infinitbility

how to check null value in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To check null value in react native, use if statement it will handle all falsy value or you can compare with null it self. Let’s see short example to use if statement to handle null value. let value = null; if(value){ console.log("value have data") } else { console.log("value is null or falsy value") } Today, I’m going to show you How do I check null value in react native, as above mentioned, I’m going to use the above-mentioned use if statement....

September 8, 2022 · 2 min · Infinitbility

how to get last word of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get last word of string in react native, use split(" ") method with strArr.length - 1 index value it will return last word from string. You have to only pass " " in split() method. Let’s see short example to use split(" ") with with strArr.length - 1 index to get last word from string. let strArr = string.split(" "); strArr[strArr.length - 1]; Today, I’m going to show you How do I get last word of string in react native, as above mentioned, I’m going to use the above-mentioned split() method....

August 22, 2022 · 2 min · Infinitbility

how to get first word of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get first word of string in react native, use split(" ") method with 0 index value it will return first word from string. You have to only pass " " in split() method. Let’s see short example to use split(" ") with with 0 index to get first word from string. string.split(" ")[0]; Today, I’m going to show you How do I get first word of string in react native, as above mentioned, I’m going to use the above-mentioned split() method....

August 19, 2022 · 2 min · Infinitbility

how to get each character of string of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To each character of string in react native, use for...of loop, it will return each character one by one. You have to just use for...of loop on your string string. Let’s see short example to use for loop on string to get each char. for (let char of string) { console.log(char) } Today, I’m going to show you How do I get each character of string in react native, as above mentioned, I’m going to use the for....

August 18, 2022 · 2 min · Infinitbility

how to get last two character of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get last two character of string in react native, use substring() method to extracts last two character from string. You have to only pass starting and ending postion of string so for last two character pass text.length - 2 as parameter it will return last two character of string. Let’s see short example to use substring() to get last two character from string....

August 17, 2022 · 1 min · Infinitbility

how to get last character of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get last character of string in react native, use substring() method to extracts last character from string. You have to only pass starting and ending postion of string so for last character pass text.length - 1 as parameter it will return last character of string. Let’s see short example to use substring() to get last character from string. text.substring(text.length - 1); Today, I’m going to show you How do I get last character of string in react native, as above mentioned, I’m going to use the above-mentioned substring() method....

August 16, 2022 · 2 min · Infinitbility

how to get first character of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get first character of string in react native, use substring() method to extracts first character from string. You have to only pass starting and ending postion of string so for first character pass 0, 1 as parameter it will return first character of string. Let’s see short example to use substring() to get first character from string. text.substring(0, 1); Today, I’m going to show you How do I get first character of string in react native, as above mentioned, I’m going to use the above-mentioned substring() method....

August 14, 2022 · 2 min · Infinitbility

how to get first two character of string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get first two character of string in react native, use substring() method to extracts first two character from string. You have to only pass starting and ending postion of string so for first two character pass 0, 2 as parameter it will return first two character of string. Let’s see short example to use substring() to get first two character from string....

August 14, 2022 · 1 min · Infinitbility

how to remove item from object in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To remove item from object in react native, use delete keyword it will remove key value pair from object only you have to mantion delete keyword with key. Let’s see how to use delete keyword to remove item from object. let exampleObject = { id: 1, name: "infinitbility", error: "Feild required" }; console.log("exampleObject", exampleObject); // Output // 'exampleObject' { // id: 1, // name: 'infinitbility', // error: 'Feild required' // } delete exampleObject....

August 10, 2022 · 2 min · Infinitbility

how to handle apostrophe in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To handle apostrophe ( single quote, or double quote ) in react native, use the ( \ ) Escape characters or ( ` ) Template literals it will handle both types quotes single and double. Let’s see how Escape characters and Template literals will solve the issue. let brokenString = 'I'm a broken string'; console.log(brokenString); // Output // unknown: Unexpected token (1:24) brokenString = 'I\'m a broken string'; console....

August 9, 2022 · 2 min · Infinitbility

how to check nan in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To check or handle NaN in react native, use the isNaN() method it will return if the value is not a number, if the value is a number it will return false. Let’s understand when the isNaN method returns false or when true. Number.isNaN(NaN); // true Number.isNaN(Number.NaN); // true Number.isNaN(0 / 0); // true // e.g. these would have been true with global isNaN() Number....

August 7, 2022 · 2 min · Infinitbility

how to check undefined in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To check or handle undefined in react native, use the if statement it will go inside in if statement if the value is not undefined. Basically, If the statement will handle all your false values like 0, false, "", undefined, etc. let value = undefined; if(value){ console.log("value have some data") } else { console.log("value is undefined") } Today, I’m going to show you How do I check or handle undefined in react native, as above mentioned, I’m going to use the if statement to check value is undefined or has some data....

August 6, 2022 · 2 min · Infinitbility

how to empty an array in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To empty an array in react native, set [] empty array in a state it will remove the existing array of elements and store a new empty array in a state. setArr([]); Today, I’m going to show you How do I empty an array in react native, as above mentioned, I’m going to use the above-mentioned set [] empty array syntax method to empty an array....

August 2, 2022 · 1 min · Infinitbility

how to pass parameter to a promise function in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To pass parameters to a promise function in react native, create a parameter function and use promise in a function like the below example. var getNameById = function (id) { return new Promise(function (resolve, reject) { // ... }); }; getNameById(3).then(function (res) { console.log(res); }); // output: "Stuff worked" Today, I’m going to show you How do I pass parameters to a promise function in react native, as above mentioned, I’m going to use the above-mentioned syntax to create and use a promise function with a parameter....

August 1, 2022 · 2 min · Infinitbility

how to add two numbers in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To add two numbers in react native, use the + addition operator it will add if your value datatype is a number else if your value datatype is string first convert it using parseInt() and then perform addition operation. In the following example, we will take the sample numbers, and strings and perform add operation using the + addition operator. Adding Two numbers example let num1 = 30; let num2 = 34; num1 + num2; // 64 Adding Two string numbers example let num1 = "30"; let num2 = "34"; parseInt(num1) + parseInt(num2); // 64 Today, I’m going to show you How do i add two numbers in react native, as mentioned above here, I’m going to use the + addition operator....

July 15, 2022 · 2 min · Infinitbility

how to center text in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To center text in react native, just use the textAlign css property it will center text horizontaly and for vertical center flex: 1, justifyContent: "center", on upper element. Today, I’m going to show you How do I center text in react native, as above mentioned here, I’m going to use the textAlign and justifyContent css property to make text center. Let’s start today’s tutorial how do you center text in react native?...

July 9, 2022 · 2 min · Infinitbility

how to remove double quotes from string in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To remove double quotes from a string in react native, just use the replaceAll('"', '') method it will replace double quotes with an empty string and return a new string without double quotes. Like the following example, let’s take the below sample string example here we will remove all double quotes available in the string. const str = 'Hi" Friend"s, Welcome "to" infinitbility'; // 👇️ 'Hi Friends, Welcome to infinitbility' str....

July 6, 2022 · 2 min · Infinitbility

how to check empty object in react native?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To check the empty object in react native, just use the Object.keys() method it will create an array of object keys after then you can check the length and if it’s equal to 0 means the object is empty. Like the following example, let’s take the below array of objects example here we will find an index of id 3 and delete it from the array....

June 28, 2022 · 2 min · Infinitbility

how to remove react native cli globally?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To remove react native cli globally, just use the npm uninstall -g react-native-cli command in your cmd or terminal it will uninstall react native cli from your computer. As per react native documents, they are telling you shuld remove react native cli and just use your cammand with npx it will work. If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues....

June 27, 2022 · 1 min · Infinitbility