Install Locator on React codebase. This is data-ids variant which is alternative solution for devtools variant.
npm install -D @locator/babel-jsx
Add custom babel config to your Next.js project. Create of modifybabel.config.js file.module.exports = {
presets: ["next/babel"],
plugins: [
["@locator/babel-jsx/dist", {
env: "development",
}]
]
};
npm install -D @locator/runtime
Add this to pages/_app.jsx (or other global file):import setupLocatorUI from "@locator/runtime";
if (process.env.NODE_ENV === "development") {
setupLocatorUI();
}