DEV Community

Cover image for React.js–Get started in Dart #2
Jermaine
Jermaine

Posted on • Originally published at creativebracket.com

4 1

React.js–Get started in Dart #2

In Part 1 of this series, we built our Greeting component that took a name parameter and rendered this onto the screen. Here's what the snippet for this looked like:

var Greeting = createReactClass({
  "render": allowInteropCaptureThis(
    (ReactClassInterface self) => React.createElement(
      'h1', null, ['Hello, ${getProperty(self.props, "name")}']),
  )
});
Enter fullscreen mode Exit fullscreen mode

And we used it by doing:

void main() {
  ReactDOM.render(
    React.createElement(
      Greeting,
      makeJsObject({
        'name': 'John'
      }),
      null,
    ),
    querySelector('#output'),
  );
}
Enter fullscreen mode Exit fullscreen mode

In this part, we will refactor our solution and proceed to build out the stateful component example. Here's the video:

Watch on YouTube
Get the source code


Conclusion

I hope this was insightful and you learned something new today.

Subscribe to my YouTube channel to be notified when Part 3 is ready. Thanks!

Like, share and follow me 😍 for more content on Dart.

Further reading

  1. js package
  2. How to Use JavaScript libraries in your Dart applications
  3. Full-stack web development with Dart

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (2)

Collapse
 
vinceramces profile image
Vince Ramces Oliveros

Just finished reviewing re-introduction to JavaScript and ready to move to ReactJS just to build my own SPA Portfolio. I really wanted to integrate it with my dart project. Great Article!

Collapse
 
creativ_bracket profile image
Jermaine

Nice one Vince, glad it's helping. I'll be doing more React videos in the future. And thanks for subscribing to the channel ;) Would also be great if you could share the video

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay