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 ...

Unhandled Runtime Error TypeError: Do not know how to serialize a BigInt

When i was developing a next js application, i got a requirement to work with datatype Bigint.During my coding i got an error 


Unhandled Runtime Error TypeError: Do not know how to serialize a BigInt


I was calling an api to update user data which is having a bigint datatype key value pair in the body as shown below.




In order to fix the error what i did that i attached a function definition for toJSON at the prototype of BigInt data type.As we all know BigInt is one of the primitive data type in javavscript.Please check the below code for the function definition for the toJSON method 


BigInt.prototype.toJSON = function() { return this.toString() }






By definie the toJSON at prototype of BigInt,I could fix the error ,Unhandled Runtime Error TypeError: Do not know how to serialize a BigInt and i executed the next js project without any error