Comments (5)
@Suchlikesamsung what do you mean by internal communication? IPC or nextjs API way ?
from nextron.
@Suchlikesamsung what do you mean by internal communication? IPC or nextjs API way ?
This is endpoint communication using pages/api.
from nextron.
ok. gotcha.
what I simply do is define functions inside the pages/api/method.js
file and export each of them. And I just call them in my pages.
from nextron.
The problem is that it works normally on localhost, but when I create a product, it doesn't work as above. Do I need to call the function directly in a production environment?
this is my chargerborad component
const fetchData = async () => {
try{
const response = await fetch('/api/userdata');
const result = await response.json();
console.log(result.data)
return result.data;
} catch (error){
console.error("component mount error!",error);
throw error;
}
}
const ChargerBoard: React.FC = () => {
const [data, setData] = useState<string | null>(null);
useEffect(() => {
fetchData()
.then((apidata) => setData(apidata))
.catch((error) => console.error("error",error));
},[]);
return (
)
};
export default ChargerBoard;
좋아요. 알았어. 내가 하는 일은
pages/api/method.js
파일 내부에 함수를 정의하고 각각을 내보내는 것입니다. 그리고 난 그냥 내 페이지에서 그들을 호출합니다.
from nextron.
@Suchlikesamsung I cannot see your image, you just have to call that function in prod, and it works. and in that function, you call fetch your data from anywhere without issue :)
from nextron.
Related Issues (20)
- install directly with app router? HOT 2
- Command line arguments not working in dev command HOT 1
- Electron updater HOT 9
- ESM: latest sindresorhus packages support HOT 3
- IPC example HOT 14
- i18next Localization of dynamic pages does not work in the build HOT 2
- Nextron Tailwind Example does not work with `pnpm` HOT 2
- Vercel backend SSR / server actions HOT 1
- How to remove window.ipc.on listener? HOT 1
- cat not start debugger port
- error: unknown option '-o' HOT 16
- remote debugging HOT 1
- Nextron v9 with next js 14.2.4 white window in prod build with page router and electron 31 HOT 8
- Next Ui Support HOT 1
- vscode debug not work
- Is there an example of next js app router ? I tried ,but failed. HOT 3
- Monorepo: "Next not found in both dependencies and devDependencies."
- Nextron js is completely broken - Everything does not seems to work anymore HOT 3
- Nextron exports the build results to "app" directory, so please set "distDir" to "../app" in next.config.js HOT 1
- Using next js 14 app router,When nodeIntegration set to true,the useEffect not trigger,
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextron.