Small nitpick about your example:
const ALERT_STATUS = (message) => ({ warning: <AlertComponent status="warning" message={message}/>, error: <AlertComponent status="error" message={message}/>, success: <AlertComponent status="success" message={message}/>, info: <AlertComponent status="info" message={message}/> }) let newVariable = ALERT_STATUS(messageState)[status];
will create all the components virtual dom initialized with the message. This may not be too much of a performance issue, but could potentially trigger side effects. It would therefore be better to use
const ALERT_STATUS = { warning: (message) => <AlertComponent status="warning" message={message}/>, error: (message) => <AlertComponent status="error" message={message}/>, success: (message) => <AlertComponent status="success" message={message}/>, info: (message) => <AlertComponent status="info" message={message}/> } let newVariable = ALERT_STATUS[status](messageState);
Thanks for your correction! :) I dont consider about that. Will update it later.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Small nitpick about your example:
will create all the components virtual dom initialized with the message. This may not be too much of a performance issue, but could potentially trigger side effects. It would therefore be better to use
Thanks for your correction! :)
I dont consider about that. Will update it later.