+ 2
Background Colour React
How can I change the background-colour of the body based on a condition in React. In this case, the time of the day. Edit: Another error, the image won't render. Does anyone know the correct syntax for <img> in JSX? https://code.sololearn.com/W714mbHH6290/?ref=app
2 Respuestas
+ 1
1. Add styles.color assignment in each if code block, before return.
2. Your return img is never reached. Either advance them into return in each code block. or use a str to store the result of if, and add the img at last after if, before return.
https://code.sololearn.com/WhzetWWe0Z6G/?ref=app
+ 3
To make good use of virtual dom, we should always use react state management and life cycle methods..
Check out this code how state management to auto update the dom from life cycle componentWillMount method:
https://code.sololearn.com/Wwua1yjN2B6x/?ref=app