Can someone tell me why my javascript higher-order function won’t work as intended?

This is my code, and for some reason, whenever I put in a value less than 4, I get array with 5 elements instead of 3. What could I be doing wrong? Javascript isn’t returning that there is an error in the code.

let actionPlan = ['1. Oatmeal bath',
    '2. Drink 16 oz water',
    '3. Put on 100% cotton shorts',
    '4. Butterfly pose',
    '5. Pigeon Pose',
    '6. Lidocaine gel',
    '7. 200 mg pyridium'
];


function painManagement (painLevel) {
    if (painLevel >= 7) {
        return function () {
            return actionPlan;
        }
    } else if (3 < painLevel < 7) {
        return function () {
            return actionPlan.slice(0,5);
        }
    } else if (0 < painLevel < 4) {
        return function () {
            return actionPlan.slice(0,3);
        }
    } else if (painLevel === 0) {
        return 'Hooray, no pain!';
    }
}

console.log(painManagement(2)());

//Output (5) ['1. Oatmeal bath', '2. Drink 16 oz water', '3. Put on 100% cotton shorts', '4. Butterfly pose', '5. Pigeon Pose']

API Gateway: 403 Forbidden ‘Webhook Signature Failed’ Issue

For my project, I’ve been designing a website with an Angular front end and a DynamoDB backend. Eventually, this website is supposed to print out a list of modules, browsers, environments, etc. Currently, the POST API that is used to interface has no authorization needed, so authorization is set to none. As the AWS tutorials say, the plan is to utilize a function that will interface with DynamoDB, be uploaded to Lambda, and then connect Angular to Lambda through the API Gateway service. However, I’ve hit a roadblock. When I attempt to fetch the data, I get a 403: forbidden error. I also get the text ‘Webhook Signature Failed.’ Repeatedly trying to fetch doesn’t work, and this error can be reproduced in Postman as well as the API Gateway’s own tester. I wanted to create this question because AWS’s own tutorial didn’t provide any info about Webhooks, and other StackOverflow questions seemed to indicate a use of authorization/API keys, which I don’t have currently. The lambda function has already been created and deployed.

I wanted to create this question because AWS’s own tutorial didn’t provide any info about Webhooks, and other StackOverflow questions seemed to indicate a use of authorization/API keys, which I don’t have currently.

How Do I make my sliding login/register page display the correct container

I Basically copied one of those sliding login/register pages, customized the CSS a bit and now I started doing backend for my project, I got to the part where I want to redirect users to register, but it opens the login form by default, then when they press sign up it slides over, How do I fix this? Here is the relevant html

<div class="container" id="main">
        <div class="sign-up" id= "register-panel">
            <form action="Php/register_form.php" method="post">
                <h1>Create Account</h1>
                <p>or use your email for registration</p>
                <input type="text" name="txt" placeholder="Name" required="">
                <input type="email" name="email" placeholder="Email" required="">
                <input type="password" name="pswd" placeholder="Password" required="">
                <input type="number" class="phone" name="phone" placeholder="Phone Number" inputmode="numeric" required="">
                <button type="submit">Sign Up</button>

                <?php
                session_start();
                $register_error = isset($_SESSION['register_error']) ? $_SESSION['register_error'] : '';
                if ($register_error != '') {
                    echo '<p style="color: crimson;font-size:10px;font-weight:Bold;padding-bottom:10px">' . $register_error . '</p>';
                    // Clear the error message after displaying
                    $_SESSION['register_error'] = '';
                }
                ?>

            </form>
        </div>
        <div class="sign-in" id = "login-panel">
            <form action="Php/login_form.php" method="post">
                <h1>Sign In</h1>
                <p>or use your account</p>
                <input type="text" name="txt" placeholder="Name" required="">
                <input type="password" name="pswd" placeholder="Password" required="">
                <button type="submit">Sign In</button>
                
                <?php
                $login_error = isset($_SESSION['login_error']) ? $_SESSION['login_error'] : '';
                if ($login_error != '') {
                    echo '<p style="color: crimson;font-size:24px;font-weight:Bold">' . $login_error . '</p>';
                    // Clear the error message after displaying
                    $_SESSION['login_error'] = '';
                }
                ?>

            </form>
        </div>
        <div class="overlay-container">
            <div class="overlay">
                <div class="overlay-left">
                    <h1>Welcome Back!</h1>
                    <p>To stay connected with us, please login with your personal info</p>
                    <button id="signIn" data-panel = "login">Sign In</button>
                </div>
                <div class="overlay-right">
                    <h1>Hello Friend!</h1>
                    <p>Enter your personal details and start your journey with us</p>
                    <button id="signUp" data-panel = "register">Sign Up</button>
                </div>
            </div>
        </div>
    </div>

I tried adding ?panel=register to the url to load the register panel by default and it didn’t work

For some reason, I can’t set a background image for a fabric.js canvas, working with SvelteKit

I’m trying to make a whiteboard app, and write over a background image using fabric.js and sveltekit, for other functionality, that I’ll implement if I ever manage to go past this.
This is basically what I currently have. This is the main +page.svelte file, on the routes folder. The image simply doesn’t appear, but the canvas is initialized.

<script lang="ts">
    import * as fabric from 'fabric';
    import { onMount } from 'svelte';

    let canvasEl: HTMLCanvasElement;
    let canvas: fabric.Canvas;

    onMount(() => {
        const imageUrl = "../src/lib/assets/EXAMPLE.png";

        canvas = new fabric.Canvas(canvasEl, {
            width: 1920,
            height: 3280,   
            isDrawingMode: false,
        });

        fabric.Image.fromURL(imageUrl, (img) => {
            canvas.backgroundImage = img;
            canvas.renderAll();
        });

        canvas.renderAll();
    });


</script>

<canvas bind:this={canvasEl}> 
</canvas>

I tried different ways of setting the background image. With the setBackgroundImage method, with canvas.backgroundImage as it is in the example. None of that worked.
I tried different ways of writing the url, and maybe it could be that the path is wrong for some reason, the network tab on the browser requests the image successfully, so I don’t think is that.
I even tried making an image object, then creating a fabric.Image and then try to set background image, but it didn’t work either.

Is this is right way to implement Thirdweb authentication with saving user in our backend database if user not present

// UserLoginProvider.js
export const UserLoginProvider = ({ children }) => {
  const [walletAddress, setWalletAddress] = useState("");
  const [loggedIn, setLoggedIn] = useState(false);

  useEffect(() => {
    const getUserLoggedIn = async () => {
      let isLogin = await isLoggedIn();
      setLoggedIn(isLogin);
    };
    getUserLoggedIn();
  }, [walletAddress]);

  // ... other state and functions

  return (
    <UserLoginContext.Provider value={value}>
      {children}
    </UserLoginContext.Provider>
  );
};

// ConnectBtn.js
export default function ConnectBtn() {
  // ... state and functions from useUserLogin()
const {
    setWalletAddress,
    setIsLoading,
    setIsError,
    setWallet,
    connectButtonRef,
    setLoggedIn,
  } = useUserLogin();
  const { disconnect } = useDisconnect();
  const { refetchProducts } = useProducts();
  const clientBackend = {
    clientId: "d41dd66624d7e93e047a1285c00e9dd2",
    secretKey: undefined,
  };

  const saveInDatabaseHandler = async (
    walletAddress: string,
    wallet: Wallet
  ) => {
    try {
      setIsLoading(true);
      const email = await getUserEmail({ client: clientBackend });
      if (!email) {
        disconnect(wallet);
      }
      const payload = {
        email: email,
        wallet_address: walletAddress,
      };
      const response = await CreateUserService(payload);
      if (response && response.token) {
        localStorage.setItem("token", response.token);
      }
      setWalletAddress(walletAddress);
      setWallet(wallet);
      await refetchProducts();
    } catch (err) {
      console.log(err);
      setIsError(true);
      disconnect(wallet);
    } finally {
      setWalletAddress("");
      setIsLoading(false);
    }
  };

  const handleDisconnect = async () => {
    localStorage.removeItem("token");
    setWalletAddress("");
    setIsLoading(false);
    setWallet(null);
    await refetchProducts();
  };
  return (
    <ConnectButton
      // ... configuration props
      auth={{
        isLoggedIn: async (address) => {
          let userLoggedIn = await isLoggedIn();
          return userLoggedIn;
        },
        doLogin: async (params) => {
          await login(params);
        },
        getLoginPayload: async ({ address }) => generatePayload({ address }),
        doLogout: async () => {
          await logout();
        },
      }}
      onConnect={async (wallet) => {
        const acc = wallet.getAccount();
        await saveInDatabaseHandler(acc.address, wallet);  //This request will go to the backend first to generate the user if user is not present.
      }}
      onDisconnect={handleDisconnect}
    />
  );
}

Is this approach of combining Thirdweb’s ConnectButton with custom authentication logic (including server-side checks and a separate database for user management) a valid and recommended way to implement user login and wallet connection in a Thirdweb-based application? Are there any potential issues or best practices we should be aware of when implementing this pattern?

Its working but sometimes giving , 429 too many embedded Third web calls, and producing too many request error from sentry.

How to Execute JavaScript Functions from Non-Editable Elements in TinyMCE?

I have non-editable buttons inside the TinyMCE text editor. I want to insert a JavaScript function so that when these buttons are clicked, the text “Hello world” is logged to the console. Here is the relevant HTML and JavaScript setup

<textarea id="tinymce">
    <div class="myclass">
        <button onclick="myFunction()">button outside</button>
    </div>
    <div class="myclass non-editable">
        <button onclick="myFunction()">button Inside</button>
        <button onclick="myFunction()">button Inside</button>
    </div>
</textarea>
tinymce.init({
    selector: 'textarea#tinymce',
    height: 500,
    content_style: `
        body { font-family:Helvetica,Arial,sans-serif; font-size:16px }
        .myclass { border: 0.1rem solid green; border-radius: 0.8rem; padding: 0.2rem; }
        .non-editable { border-color: red; }
    `,
    noneditable_class: 'non-editable'
});

function myFunction() {
    console.log("Hello world");
}

I have tried inserting the myFunction script directly into the TinyMCE content fragment, but the buttons inside the editor still don’t trigger the function. Does TinyMCE support this type of functionality?

I need help editing my business cards with the help of swiper [closed]

I have 12 jobData variables: I want to control them with the next and prev button. I want my 6 cards to be arranged in 2 rows and 3 columns. I want the remaining 6 cards to appear on my screen in the same way when I press the next button.i uploaded original page.
I created my codes like this, but they are not arranged as 2 lines and 3 columns as I wanted.You can find them in the attachment.enter image description here

Does anyone know how to create this cursor shape effect?

The idea is having a shape. When the cursor hovers and then moves away from the shape, part of the circle stretches towards the shape before moving back. Created an image to illustrate what I mean.

First the cursor can hover, then as it leaves the shape the edge of the shape stretches towards the cursor. Once the cursor is far enough away the edge of she shape snaps back. From this point if you hover over the circle again the same thing will happen.

enter image description here

Best practice to wirte maintainable code in javascript or react? [closed]

Is it a good practice to write console.log statements for api failures in try catch?

I am trying learn more here about what’s best to follow in long term. I have seen senior developers writing or approving the code to production even with console.log statements in code base.

However while reading through some guidelines and following linting rules I see that it’s not recommended approach.

Can any senior person shade some light on this?

How to get raw json or other data for onecall ticket

I am trying to get the data that populates the ticket here: https://ia.itic.occinc.com/iarecApp/ticketSearchAndStatusView.jsp?enc=%2B%2FG1BMVDAKGJSwm2QiSowfk5NrkGvXR9ZW9t6AwXqmv0wkQXl%2FZjXxhBxVIJbBZH

For starters I am focusing on the Ticket No. I have been searching through the network tab in the developer tools trying to find an api endpoint with a json file or something that I can GET request using python to get the data easier than parsing the html of the webpage. It has to get the data from somewhere, but I’m not sure exactly what to look for.

Uncaught runtime errors: ERROR dispatcher is null

Trying to use chart.js, but everytime i try fetch the data it throws me ‘Uncaught runtime errors:
ERROR
dispatcher is null’ this error. The page doesn’t render at all, everything on there is gone, before i tried to use chart.js i had a list of the data i wanted to put into the graph.

I have tried uninstalling and reinstalling chart.js, react-router-dom etc. and still the problem persists. I’m not sure whether or not this is an issue with my code or something to do with my environment. Any suggestions would be a massive help. Thank you. This is my file where the error may be.

import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { useParams } from 'react-router-dom';
import { Line } from 'react-chartjs-2';
import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend } from 'chart.js';

// Register Chart.js components
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);

function Security() {
  const { id } = useParams();
  const [security, setSecurity] = useState(null);
  const [priceHistories, setPriceHistories] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      try {
        const securityResponse = await axios.get(`http://localhost:5000/securities/${id}`);
        setSecurity(securityResponse.data.security);

        const priceHistoriesResponse = await axios.get(`http://localhost:5000/securities/${id}/price-histories`);
        if (Array.isArray(priceHistoriesResponse.data)) {
          const formattedPriceHistories = priceHistoriesResponse.data.map(history => {
            const date = new Date(history[1]);
            if (isNaN(date)) {
              return { date: history[1], price: history[2] };
            }
            return { date: date.toISOString().split('T')[0], price: history[2] };
          });
          setPriceHistories(formattedPriceHistories);
        }
      } catch (error) {
        console.error( error);
      }
    };

    fetchData();
  }, [id]);

  const chartData = {
    labels: priceHistories.map(history => history.date),
    datasets: [
      {
        label: 'Price History',
        data: priceHistories.map(history => history.price),
        borderColor: 'rgba(75, 192, 192, 1)',
        backgroundColor: 'rgba(75, 192, 192, 0.2)',
        fill: false,
      },
    ],
  };

  const chartOptions = {
    responsive: true,
    plugins: {
      legend: {
        position: 'top',
      },
      tooltip: {
        callbacks: {
          label: function(tooltipItem) {
            return `Price: $${tooltipItem.raw}`;
          }
        }
      }
    },
    scales: {
      x: {
        title: {
          display: true,
          text: 'Date',
        },
        type: 'time',
        time: {
          unit: 'day',
          tooltipFormat: 'll',
        },
      },
      y: {
        title: {
          display: true,
          text: 'Price ($)',
        },
      },
    },
  };

  if (!security) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      <h1 className='security-header'>Price History for {security[1]}</h1>
      <Line data={chartData} options={chartOptions} />
      <table>
        <thead>
          <tr>
            <th>Date</th>
            <th>Price</th>
          </tr>
        </thead>
        <tbody>
          {priceHistories.map((history, index) => (
            <tr key={index}>
              <td>{history.date}</td>
              <td>{history.price}</td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  );
}

export default Security;

Vite/Rollup: Globals ignored, “No name was provided for external module”

For some reason, Rollup refuses to recognize my global external dependencies.

From my vite.config.ts:

export default defineConfig({
  build: {
    rollupOptions: {
      external: ['radash', '@leeoniya/ufuzzy'],
      output: {
        globals: {
          radash: '_',
          '@leeoniya/ufuzzy': 'Fuzzy',
        },
      },
    },
  },
[...]

From my Vite build:

No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".
No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".
No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".
No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".
No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".
No name was provided for external module "radash" in "output.globals" – guessing "_".
No name was provided for external module "@leeoniya/ufuzzy" in "output.globals" – guessing "Fuzzy".

I’ve also tried using vite-plugin-externals with the same result. The consequences is that my builds, which finish successfully, are broken when loaded in the browser and throw a console error:

Failed to resolve module specifier "radash". Relative references must start with either "/", "./", or "../".

Is this a bug or am I doing something wrong? I’m using Sveltekit if that matters.

Having trouble running a project locally/ npm install, dependency issues

I am trying to run an example project locally. Its a full stack project so it needs to access a mongodb database. I downloaded the project files, and ran npm install so I could get everything set up, but I think I’ve been running into dependency chaos…

I keep getting a bunch of errors when I try npm install

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"^15.0.0" from the root project
npm error   peer react@"^15.0.0 || ^16.0.0" from [email protected]
npm error   node_modules/react-bootstrap-table
npm error     react-bootstrap-table@"^4.3.1" from the root project
npm error   2 more (react-modal, react-s-alert)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.14.0" from [email protected]
npm error node_modules/react-dom
npm error   peer react-dom@"^0.14.0 || ^15.0.0 || ^16 || ^17" from [email protected]
npm error   node_modules/react-modal
npm error     react-modal@"^3.1.7" from [email protected]
npm error     node_modules/react-bootstrap-table
npm error       react-bootstrap-table@"^4.3.1" from the root project
npm error   peer react-dom@">=16.8" from [email protected]
npm error   node_modules/react-router-dom
npm error     react-router-dom@"^6.0.2" from the root project
npm error   1 more (react-s-alert)
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/react
npm error   peer react@"^16.14.0" from [email protected]
npm error   node_modules/react-dom
npm error     peer react-dom@"^0.14.0 || ^15.0.0 || ^16 || ^17" from [email protected]
npm error     node_modules/react-modal
npm error       react-modal@"^3.1.7" from [email protected]
npm error       node_modules/react-bootstrap-table
npm error         react-bootstrap-table@"^4.3.1" from the root project
npm error     peer react-dom@">=16.8" from [email protected]
npm error     node_modules/react-router-dom
npm error       react-router-dom@"^6.0.2" from the root project
npm error     1 more (react-s-alert)
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:UsersTassneenAppDataLocalnpm-cache_logs2024-07-18T19_49_34_347Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:UsersTassneenAppDataLocalnpm-cache_logs2024-07-18T19_49_34_347Z-debug-0.log

I then tried it with –legacy peer deps and still got issues.

I also just tried running node index.js just to see what would happen and I got errors saying it doesn’t recognize ‘mongodb’??

<filelocation>node index.js
Connected successfully to db server
C:..full-stack-banking-app-mainnode_modulesmongodblibutils.js:698
          throw error;
          ^

TypeError: Cannot read properties of undefined (reading 'db')
    at C:UsersTassneenDesktopMITxProfull-stack-banking-app-maindal.js:12:17
    at C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibutils.js:695:9
    at C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibmongo_client.js:285:23
    at C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodbliboperationsconnect.js:285:21
    at parseConnectionString (C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibcoreuri_parser.js:580:12)
    at connect (C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodbliboperationsconnect.js:283:3)
    at C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibmongo_client.js:284:5
    at maybePromise (C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibutils.js:692:3)
    at MongoClient.connect (C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibmongo_client.js:280:10)
    at MongoClient.connect (C:UsersTassneenDesktopMITxProfull-stack-banking-app-mainnode_modulesmongodblibmongo_client.js:426:22)

Node.js v20.12.1

I’m sure it was to do with dependency issues and/or outdated versions, but since I’m still very new to this, it’s been really hard to debug and understand.

This is DAL script where it sets up the mongodb connection for reference:

const dotenv = require("dotenv")
dotenv.config();

const MongoClient = require('mongodb').MongoClient;
const url         = process.env.MONGODB_URI;
let db            = null;
 
// connect to mongo
MongoClient.connect(url, {useUnifiedTopology: true}, function(err, client) {
    console.log("Connected successfully to db server");
    // connect to  database
    db = client.db('banking_app');
});

// create user account
function create(name, email, uid) {
    return new Promise((resolve, reject) => {    
        const collection = db.collection('users');
        const doc = {name, email, uid, balance: 0};
        collection.insertOne(doc, {w:1}, function(err, result) {
            err ? reject(err) : resolve(doc);
        });    
    })
}

// find user account
function find(email) {
    return new Promise((resolve, reject) => {    
        const customers = db
            .collection('users')
            .find({email: email})
            .toArray(function(err, docs) {
                err ? reject(err) : resolve(docs);
        });    
    })
}

// find user account
function findOne(email) {
    return new Promise((resolve, reject) => {    
        const customers = db
            .collection('users')
            .findOne({email: email})
            .then((doc) => resolve(doc))
            .catch((err) => reject(err));    
    })
}

// update - deposit/withdraw amount
function update(email, amount) {
    return new Promise((resolve, reject) => {    
        const customers = db
            .collection('users')            
            .findOneAndUpdate(
                {email: email},
                { $inc: { balance: amount}},
                { returnOriginal: false },
                function (err, documents) {
                    err ? reject(err) : resolve(documents);
                }
            );            

    });    
}

// all users
function all() {
    return new Promise((resolve, reject) => {    
        const customers = db
            .collection('users')
            .find({})
            .toArray(function(err, docs) {
                err ? reject(err) : resolve(docs);
        });    
    })
}

module.exports = {create, findOne, find, update, all};

react: how to reset id of a tsx as array element

i am new to tsx and react and trying to make tic tac toe. i want to change the id of every box (a div element in an array) on click so that i would be able to change its css (seperating color of X and O), but i am unable to do that. Pls help

here is my code:

let createTileSetup = Array(9);
  for (let i = 0; i < 9; i++) {
    createTileSetup[i] = (
      <div className="filler" id={i.toString()}>
        .
      </div>
    );
  }

  const [tiles, setTiles] = useState(createTileSetup);
function makeBoard() {
    return (
      <>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(0);
            }}
          >
            {tiles[0]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(1);
            }}
          >
            {tiles[1]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(2);
            }}
          >
            {tiles[2]}
          </div>
        </div>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(3);
            }}
          >
            {tiles[3]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(4);
            }}
          >
            {tiles[4]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(5);
            }}
          >
            {tiles[5]}
          </div>
        </div>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(6);
            }}
          >
            {tiles[6]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(7);
            }}
          >
            {tiles[7]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(8);
            }}
          >
            {tiles[8]}
          </div>
        </div>

<!--places the stuff around on a 3x3 pattern-->
  function tileClicked(index: number) {
    if (CheckGameBoard() == "Continue") {
      placeTile(index);
    }
    if (CheckGameBoard() == "Win") {
      setMessage(move + " has won");
    }
  }
//CheckGameBoard is just checking if anyone won or not etc
function placeTile(index: number) {
    if (tiles[index] !== "X" && tiles[index] !== "O") {
      let updateTile = tiles.slice();
      updateTile[index] = move;
      setTiles(updateTile);
    } else {
      "This is filled spot " + index;
    }
  }

based on this i have wrote css. If there is any other way to change colors of X and O when placed it is appreciated.

Here is the whole code together if it helps

import { useState, useEffect } from "react";
import "./Board.css";

let possibilities = [
  [0, 1, 2],
  [3, 4, 5],
  [6, 7, 8],
  [0, 3, 6],
  [1, 4, 7],
  [2, 5, 8],
  [0, 4, 8],
  [2, 4, 6],
];
let move = "X";

export default function Game() {
  let createTileSetup = Array(9);
  for (let i = 0; i < 9; i++) {
    createTileSetup[i] = (
      <div className="filler" id="filler">
        .
      </div>
    );
  }

  const [tiles, setTiles] = useState(createTileSetup);

  const [message, setMessage] = useState(move + " to move");

  useEffect(() => {
    const gameResult = CheckGameBoard();
    if (gameResult === "Win") {
      setMessage(move + " has won");
    }
    if (CheckGameBoard() === "Continue") {
      move == "X" ? (move = "O") : (move = "X");
      setMessage(move + " to move");
    }
  }, [tiles]);

  function placeTile(index: number) {
    if (tiles[index] !== "X" && tiles[index] !== "O") {
      let updateTile = tiles.slice();
      updateTile[index] = move;
      setTiles(updateTile);
    } else {
      "This is filled spot " + index;
    }
  }

  function tileClicked(index: number) {
    if (CheckGameBoard() == "Continue") {
      placeTile(index);
    }
    if (CheckGameBoard() == "Win") {
      setMessage(move + " has won");
    }
  }

  function CheckGameBoard() {
    for (let i = 0; i < 8; i++) {
      let [a, b, c] = possibilities[i];
      if (
        (tiles[a] == "X" || tiles[a] == "O") &&
        tiles[a] == tiles[b] &&
        tiles[a] == tiles[c]
      ) {
        return "Win";
      }
    }
    return "Continue";
  }

  function makeBoard() {
    return (
      <>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(0);
            }}
          >
            {tiles[0]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(1);
            }}
          >
            {tiles[1]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(2);
            }}
          >
            {tiles[2]}
          </div>
        </div>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(3);
            }}
          >
            {tiles[3]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(4);
            }}
          >
            {tiles[4]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(5);
            }}
          >
            {tiles[5]}
          </div>
        </div>
        <div className="BoardRow">
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(6);
            }}
          >
            {tiles[6]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(7);
            }}
          >
            {tiles[7]}
          </div>
          <div
            className="SquareTile"
            onClick={() => {
              tileClicked(8);
            }}
          >
            {tiles[8]}
          </div>
        </div>

        <button
          className="reset"
          onClick={() => {
            move = "O";
            setTiles(Array(9).fill(<div className="filler">.</div>));
          }}
        >
          reset
        </button>
        <div className="status">{message}</div>
      </>
    );
  }

  return <>{makeBoard()}</>;
}

But now how to i access and change the html in it