Trying to pass dynamic data from props to the inside of a text loaded from server (using MERN stack)

125
March 08, 2021, at 4:40 PM

I have some data returned from the server: [ { name: "example1", paragraph: "Some random text ${ValueIwantToPass}" }, etc ]

I fill textareas with these texts. I want in the front-end to pass dynamic the ${ValueIwantToPass} inside the text from props from other component and to be able to edit the text. Is it possible?

Answer 1

maybe it's work for you

make state

state={
response:[]
}

change server res to :

[ { name: "example1", paragraph: "Some random text" }, etc ]

(delete ${ValueIwantToPass} from res)

save server res to state

this.setState({response:res.data})

then change it:

var response=[...this.state.response]
var ValueWantToPass=this.prop.ValueWantToPass
response[0].paragraph += ValueWantToPass
this.setState({response})
Rent Charter Buses Company
READ ALSO
How can i make this disconnect command work?

How can i make this disconnect command work?

How can I make this disconnect command work?

149
python pandas dataframe missplaced

python pandas dataframe missplaced

my pandas dataframe is not correctly placing items when i append new row to iti use a function to make it easier to append

159
Why fragments and views doesn't obfuscate?

Why fragments and views doesn't obfuscate?

Although Fragment and View classes aren't android MainComponent and no reference of them in AndroidManifestxml, but classes that extends Fragment or View don't change their name/package when minify is enabled and Proguard is working well

109