DEV Community

Osinachi Chukwujama
Osinachi Chukwujama

Posted on

Exploring React

Seems like I've been exploring a lot these days. That means I've to settle down and build actual projects. So, this time it's the all popular React. I must say, I imagine writing components for every little thing that needs to get done. At the end, My project would have >= 80 JS files. 😅 Just Kidding.

But that's just imagination. Right now, I'm still learning the ropes. I understand that components are created either by:

  1. Using class syntax
  2. Using functions which receive props as arguments After creating components, they are rendered using
ReactDOM.render(<Component />, desired-node)
Enter fullscreen mode Exit fullscreen mode

Something a little more real

Let's assume we have a div with id = "test node"

If we want to fix stuff in it using react, it would probably go like this.
class MyComponent extends React.Component {
  constructor (){
    super()
  }
  render (){
    return (
      <div>
        <h1>Just another boring text in a component</h1>
      </div>
    )
  }
};

ReactDOM.render(<MyComponent />, document.querySelector('#test-node'))
Enter fullscreen mode Exit fullscreen mode

I hope I stick to this thing called React. --There are a million websites trying to teach me react--. I probably stick to it.

Oldest comments (0)