Skip to main content

Featured post

How to Insert line break in Text component in React Native

Hi, I was developing an application in react native.I have to handle lots of text data in this small react native application.I have used  Text component in react native many times. While working on this application,i had a requirement to display some text content with line breaks.I will explain it clearly with an example.I want to display a text as shown below  Welcome Please subscribe my channel I wrote react native code as shown below <View> <Text> Welcome Please subscribe my channel </Text> <View> When i run these lines of code,It will display text as shown below Welcome Please subscribe my channel   - instead of displaying in two lines with line break,it displays in a single line.So i have to find a solution to insert line break in Text component in React Native.After lots of research,i found a clean solution as shown below <View> <Text> Welcome{"\n"} Please subscribe my channel </Text> <View> Here ...

Cannot mix BigInt and other types, use explicit conversions TypeError Javascript

 


Dear friends, in this article let us discuss the error TypeError Cannot mix BigInt and other types, use explicit conversions in javascript.bigint is a primitive data type in javascript like number string etc.first let me define a bigint variable num1 in javascript and assign a value 10n to num1.Now let us try to add 5 to num1 as shown below. 


let num1 = 10n

let sum = num1 + 5;

console.log(sum)


When we run the above codes, we will get the error  TypeError Cannot mix BigInt and other types, use explicit conversions.So we can fix this TypeError using two methods


By Converting 5 to bigint  type  using BigInt() method


let num1 = 10n

let sum = num1 + BigInt(5);

console.log(sum)  //15n


Here we convert the value 5 to bigint and add it to num1 .So we got the output 15n.In this way we can fix the error  TypeError Cannot mix BigInt and other types, use explicit conversions


By Converting 5 to bigint  type  by  changing 5 to 5n


let num1 = 10n

let sum = num1 +5n;

console.log(sum)  //15n


In the above code,we convert 5 to bigint by placing n to after 5 like 5n. So num1 added to 5n ,then we got the output 15n. So using any of these methods we can fix the error  TypeError Cannot mix BigInt and other types, use explicit conversions in javascript