reactjsvitereact-server-componentsserver-actionreact-server

Server Action In Pure React Application(Using Vitejs)


Can anyone help me to create server actions in pure react app(vitejs)?

I am using vitejs and created one simple application and after the build process this application will me loaded using script tab in different project. suppose I have Application A and the one I am Trying to create is Web Application B(pure react app).

I have build the Application B and in Application A loading the application using simple HTML

Application-A:

`    <body>
  <!-- Details of Application - B  -->
    <div id="app"></div>
    <script
      crossorigin
      type="module"
      src="application-B-URL/assets/vbggjskbfgsfb.js"
    ></script>
    <link
      rel="stylesheet"
      crossorigin
      href={{application-B-URL/assets/rttggdgdghdhg.css}}
    />
  </body>    `

It's working normal but now I want to use server actions and upgrade to react 19. But I am unable to use server actions in pure react**(FYI: I  am not using any framework like Next JS, Remix, etc. It's a pure React application)**

Tried Server Actions and unable to implement in pure react application.


Solution

  • Can anyone help me to create server actions in pure react app(vitejs)?

    No, no one can. For a (Vite-built or otherwise) app, which runs entirely client-side in the web browser, there is no server that could run server actions.