This is a Livecoding Recap – an almost-weekly post about interesting things discovered while livecoding ?. Always under 500 words and with pictures. You can follow my channel, here. New streams almost every Sunday at 2pm PDT. There’s live chat, come say hai ?
After many weeks without Livecoding, we hung out again – all 10 of us. It was great ☺️
I dipped my toes in React Native and got some help from @nashio and @blackburn1911. They've done it before or had better luck with Google. Both?
We built a Hello World app that lets you browse through 6 of my Instagram photos. Tap on the right to go next, tap on the left to go previous.
Sure, it would be more intuitive to swipe, but Snapchat uses taps for going back and forth in stories, and that's my excuse. I also don't know how to make swipes.
I clicked reactnative.com and got confused immediately.
Okay, the new release cadence is monthly. Great! But how do I start using this thing? What do I do next? How do I begin? Do I need Xcode? Can I develop in a normal editor? Should I download a specialized IDE? WHAT DO I DO?
Then I tried the official docs.
Get Started With React Native. That looks promising!
And boy, was it ever. Turns out™ you don't need much to start:
react-native-cli. Docs say
watchman isn't mandatory, but it makes life better. ¯\(ツ)_/¯
You need Xcode for the iOS simulator. If you're doing Android, you'll need that simulator, too.
Then you run
react-native init NativeHelloWorld, and it creates a bunch of things that I don't understand. When you run the simulator with
react-native run-ios, a simulator shows up with your new app.
Simulators, it turns out, are huge. Even on my big fat Apple Thunderbolt display. Maybe I should get one of those new 4K monsters ?
react-native run-ios also opens a terminal with something called React Packager. Don't know what it is, but it looks necessary. I assume it's a compiler.
Poking around the React Native API was fun, and we learned a few things:
- There's no
onClick. To detect tap events, you should wrap components in
TouchableHighlight, which takes one and only one child element. I think this is silly.
- Styling happens through the
style=prop. There's no CSS. Or at least the project initiating script heavily promotes avoiding stylesheets.
- Layouting through Flexbox is encouraged. I assume you can do whatever you want, and Flexbox is the Best Practice™.
- If you use hot loading and add
state, you have to reload the app. Otherwise,
render()gets called without
stategetting initialized. That was a fun gotcha.
- Images don't size themselves. Without sizing, they're invisible.
- Debugging happens in a browser window, not the simulator. This feels funny.
Overall, I'm impressed with how easy it was to get started. If you know React, you should be able to build cool stuff.
Now we’ve just gotta figure out why
index.android.js is separate from
index.ios.js, learn more mobile development principles, then get an interesting project to poke at.
Here's how it works 👇
Then get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career.
"Man, love your simple writing! Yours is the only email I open from marketers and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"
Ready to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization
Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.
Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️