Code Sample for State of a Component in React

Hello Everyone, Can anyone suggest me below sample is right to update the state of a component in React? I am preparing for my upcoming react interview, So your suggestions are very helpful to me.

class MyComponent extends React.Component {
constructor() {
this.state = {
name: ‘Akhil’,
id: ‘101’
return (
Your Id is
, document.getElementById(‘content’)

Hi @aartiyadav

I think if you want help on React specific questions, you’ll want to take a look at the Where To Get Support page from React. They mention some places where your questions are likelier to answer.

This forum is specific to Solid related questions, so if you have questions for that feel free to ask here. (And feel free to take a look at Solid too, it’s an interesting project :))

1 Like