My React Native Journey - 5 - Build wordle clone

Issues faced when buildng a Wordle Clone using ReactNative and Expo 

Source: https://www.youtube.com/watch?v=2SpbSIPiDM0

Environment Information that is different from the one used in the video:

java version "18.0.1.1" 2022-04-22
node.js - v18.4.0
npm 8.12.2

The first issue I face at 'expo run' is this:

Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
Resolved by 'set NODE_OPTIONS=--openssl-legacy-provider'
Reference: 
I did not understand why the issue came up, or how it was resolved.. Will come back to it later.

Next, I try to move the list of words to a different file, so they don't clutter the existing code. I create a new file called words_list.js. In this, I export a named constant called word_list that has the list of words. Like so..
export const words_list = [
  "Abuse",
  "Adept",
  "Admit",.........
]

In the App.js file, I import this constant like so..
import words_list from "./data/words";

This doesn't work,
I realise the correct way is this..
import { words_list } from "./data/words";
Why are the curly braces required? The curly braces are used for import ONLY when export is named. If the export is default then curly braces are NOT USED for import.

So far, so good.




Comments

Popular posts from this blog

Reading a pre-populated sqlite database using react native with expo..

React Hooks - useState Vs useRef (An explanation)