D
D
dpablo_escobarr2021-01-14 19:07:27
React
dpablo_escobarr, 2021-01-14 19:07:27

How to implement render component after ajax request?

There is a task - to transfer the encrypted key from the server on which the react application is located to its server via api. It is necessary before each loading of any page to send this key to the server and give_ok / log out, depending on if the key is suitable.
There is an idea in my thoughts - to throw the necessary component for rendering into a function, and call it after the request is completed. I don't know about other methods yet. Maybe there is a less perverse solution?

package.json

"@testing-library/jest-dom": "^5.11.6",
    "@testing-library/react": "^11.2.2",
    "@testing-library/user-event": "^12.6.0",
    "@tinymce/tinymce-react": "^3.8.4",
    "axios": "^0.21.1",
    "mysql2": "^2.2.5",
    "path-to-regexp": "^1.7.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "tinymce": "^5.6.2",
    "tinymce-react": "^1.3.2",
    "web-vitals": "^0.2.4"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question