Message from JavaScript discussions

March 2019

— Add something like this


state = {
singleMasterAgent: null
static getDerivedStateFromProps(nextProps) {
if (nextProps.singleMasterAgent === nextProps.singleMasterAgent) return null
return {
singleMasterAgent: nextProps.singleMasterAgent

— udval15 ^

— Okay lemme try that

— Wow this works... thank you!

— Glad to help you. 😊

— Please will you advice I use only the connected props from redux? and is it okay to loose the populated field when I refresh the edit form page? I am asking because I trying to know what the best practices are

Message permanent page

— It’s okay to loose the populated fields. I think some navigators will save the state of your app if you go back. But never on refresh.
And if you use only the connected props from redux will reduce the side effects. Your functions you use should be pure, this means they don’t modify other things rather than the ones you pass as arguments. So, I don’t know how did you passed your action to your dispatcher inside the componentDidMount, but yeah, if that function is calling directly your import then it’s wrong. That’s not how redux it’s meant to function.

Message permanent page

— Okay thanks alot I really appreciate

— Am about starting to learn js

— Nice, read the pinned message I’m sure it will be helpful

— How can I extract the edited data from the text box in a cell and save the data in that cell using JavaScript.. And has no database

Message permanent page