In jsx you cannot just do that, you can use dangerouslySetInnerHTML, but i highly discourage to use it.
<script
dangerouslySetInnerHTML={{
__html: ` var s_pageName2='abc:en-us:/lo-form'`
}}
/>
If you want to store a global variable to reuse in any of your components there are differents ways for achieve that, for example using react Context and expose a custom hook to use wherever you need to.
Example :
_app.js
import { MyProvider} from '../components/MyProvider'
function MyApp({ Component, pageProps }) {
return (
<MyProvider>
<Component {...pageProps} />
</MyProvider>
)
}
export default MyApp
/components/MyProvider :
import React, { useState, useEffect,useContext } from 'react'
export const MyContext= React.createContext(null)
export function MyProvider ({ children }) {
const [myVar, setMyVar] = useState('abc:en-us:/lo-form')
return (
<MyContext.Provider value={{myVar}}>
{children}
</MyContext.Provider>
)
}
export function useApp() {
const value = useContext(MyContext)
return value
}
Then in any other component / page you can just use your hook in this way :
import { useApp } from './components/MyProvider'
const MyPage= () => {
const {myVar} = useApp()
... rest of code
}
This is just an example, you can achieve that in many ways, it depends on your app business logic.