I
I
ilyaux2019-03-18 14:12:38
React
ilyaux, 2019-03-18 14:12:38

How to implement requests via REST?

Hello, help me implement these scenarios.
- REST returns a STRING that contains the JavaScript function text, such as
ValidateJson(JSON_text);
- REACT has a JSON that is the result of the edited document
- REACT executes a JavaScript function by giving the current JSON of the edited document as an argument.
- Function returns "OK" or an error message
Q: Can REACT execute a JavaScript function sent as text (via REST)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hzzzzl, 2019-03-18
@ilyaux

here are 4 ways to create a function from a string, 1 2 4 will do kaaaak probably
https://stackoverflow.com/a/28011280
is this to play around with the language, or a case from life?
if from life, then it might be better to have a module with a function that can be imported in react
import { ValidateJson } from '../utils/functions.js'

K
Kirill Wolf, 2019-03-18
@Deimosss88

https://developer.mozilla.org/en/docs/Web/JavaScript...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question