• +91 9723535972
  • info@interviewmaterial.com

ReactJS Interview Questions and Answers

Related Subjects

Question - How to use styles in React?

Answer -

We can use style attribute for styling in React applications, which adds dynamically-computed styles at render time. It accepts a JavaScript object in camelCased properties rather than a CSS string. The style attribute is consistent with accessing the properties on DOM nodes in JavaScript.

Example

const divStyle = {  
  color: 'blue',  
  backgroundImage: 'url(' + imgUrl + ')'  
};  
  
function HelloWorldComponent() {  
  return
Hello World!
  
}  

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners