I'm trying to implement an options page in the ext...
# support-framework
f
I'm trying to implement an options page in the extension I'm working on, but it doesn't seem to be working alright. The example works fine, but when I copy and paste the exact same
options.tsx
file into my project it creates a blank page. The console logs for the option page show that there is an issue importing React, so I guess this is another issue caused due to my particular project setup using a relative import for react in my
package.json
, but it would be nice to work around it somehow.
s
Thread automatically created by Karstodes in #978320682985349130
f
This is the error I am getting in the options page console, for reference
Copy code
index.tsx:6 Uncaught ReferenceError: React is not defined
    at daMDB.../../../src/options/index.tsx (index.tsx:6:13)
    at newRequire (options.9d5b440f.js:71:24)
    at options.9d5b440f.js:122:5
    at options.9d5b440f.js:145:3
And just to double check, this is the contents of the
index.tsx
file, which is just a copy of the example.
Copy code
ts
import { useState } from "react"

function OptionsIndex() {
  const [data, setData] = useState("")

  return (
    <div>
      <h1>
        Welcome to your <a href="https://www.plasmo.com">Plasmo</a> Extension!
      </h1>
      <h2>This is the Option UI page!</h2>
      <input onChange={(e) => setData(e.target.value)} value={data} />
    </div>
  )
}

export default OptionsIndex
And unfortunately adding an explicit React import did not change the behavior, as I am getting the exact same error in the console.
Copy code
ts
import React, { useState } from "react"
2 Views