Skip to content

Tag: reactjs

Prettier adding semicolon when semi: false

I have a react component with this jsx When I save the file prettier automatically adds a semicolon infront of <Post … />. This is causing the component to fail to render. I have the semi option set to false. Answer This is happening because currently your map function is not returning anything &l…

how to use setTimeout on a react component

This question might be simple to most web developers but I am pretty new and cannot figure out the way to put a settimeout function on what I would like to show on a page. below is the example of the code I would like to add a timeout for. and here is my app.jsx which then will be exported

location props in gatsby is not defined

I am trying to use location props in my gastby page : I am passing props in my Link in pages/index.js: pages/date/[dateId]/index.js: eventually I get an error Parsing error: Identifier ‘location’ has already been declareded : Answer You should have the location variable already defined, it is like…

Build failed to compile – Attempted import error

My attempt to build for production fails every time because of this error: Attempted import error: ‘decrypt’ is not exported from ‘../../../../util/security’ (imported as ‘decrypt’). This error only appears when I try to build for production (npm run build). Here is the way…

Share QR React Native

I’m new in react/react native. I’m trying to share a QR Code as image. Generate QR works, but I want to share it as an image (whatsapp, bluetooth, etc). I tried “get base64 string encode of the qrcode” from official documentation, but I just don’t get it What I tried to do (all m…