ict.ken.be

 

Posts in Category: Reactjs

Vercel and Cloudinary giving INVALID_IMAGE_OPTIMIZE_REQUEST in Nextjs 

Categories: Reactjs

When using Nextjs image they will work fine locally, but you need to configure the trusted domains for deployments on real domains.

module.exports = {
  images: {
    formats: ['image/avif', 'image/webp'],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'res.cloudinary.com',
        port: '',
        pathname: '/YOUR-ACCOUNT/**',
      },
    ],
  },
}

npx react-native start gives invalid regular expression 

Categories: Nodejs Reactjs

Most likely your 'node_modules\metro-config\src\defaults\blacklist.js' has an invalid regular expression.

You can correct it with the expression below

var sharedBlacklist = [
  /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];

However, it's more likely that you just downloaded an older react-native example and are trying to run this with a different version than intended.

You could ensure that you install all the package.json dependencies fixed to the version the example was build with.

Or you could upgrade all packages to their latest version and fix any issues that might come from that.

At least with the second option you are ready to go with all the latest tools.

Reactjs 

Categories: Reactjs

Just some basic react cheatsheet

  • import React from "react"
  • use an expression to put comments
{/* you can use this to commend inside your jsx */}
  • useĀ a fragment if you want to quickly include an exiting html structure with more then one element at the root
<>
<h1>Some header<h1>
<h2>Some subheader<h2>
</>