// Detect dark theme
var iframe = document.getElementById('tweet-1136122559362084864-496');
if (document.body.className.includes('dark-the...
For further actions, you may consider blocking this person and/or reporting abuse
I really think this is such a cool DEV use-case: Taking a tweet and expanding on, replying to and generally going deeper on the idea.
I also think a browser extension which could add a button like this to Twitter would be kind of awesome if anyone wants to build that 😄
Announcing off-platform "Share to DEV" functionality
Ben Halpern ・ Apr 26 '19 ・ 3 min read
We actually have an existing Twitter extension we haven't touched in a while but would definitely welcome this added functionality if anyone wants to make a PR (along with some other needed updates 😬)
thepracticaldev / DevTwitter
Bringing dev.to headlines to your Twitter browsing experience.
DevTwitter Chrome Extension
Bringing dev.to headlines to your Twitter browsing experience.
Installing
Go to The Chrome Store to download the extension.
To access development releases, simply download or clone this code and load as an unpacked extension.
Unpacked Extension
hamburger menu > More Tools > Extensions
in the menu.Load unpacked extension...
and select thechrome-extension
folder.Features
Future features
Twitter is a great way to connect and collaborate with other developers, and it would be fun to build in features that did that. The dev.to team will be thinking of ways to do this, but contributions are super welcome.
It is important…
Anyway, sorry to go on a tangent, this just made me happy. 🙂
I like this too. If someone has created a tweet, there's already some interest in that subject. I liked this tweet in particular because I kept thinking about it a few hours later.
Better integration would be awesome!
Heh, I've done that a couple of times, about git and about starting Node projects. I like the spark that a tweet can form in your mind and send you down a rabbit hole following ideas and writing code and posts in response.
Absolutely!
The fastest way to get me to do something is to tell me it can't be done!
I, too, want pattern matching in javascript and i also want Maybes and Eithers.
I like this one dev.to/_gdelgado/type-safe-error-h...
Currently im working on trying to reduce all the friction that happens when a language doesn’t support it more natively, hopefully have a post up with samples in the next month or so :)
Same. You can use Maybes and Eithers today with a package import. The barrier is getting people familiar with them. Right now there's a lot of push back against them just because of familiarity bias.
If the language adopted them as native though, people would jump on board.
People are silly like that.
I think so too. Rust has them, they are called Option and Result. I secretly want Rust to become more popular so people can learn about them and how useful they are, and also start using them in other languages (and by other i mean javascript)
Interestingly, Rust has started to become more popular in Web Land as a language for writing WASM modules, in part because of the strong support from the Rust team themselves. See developer.mozilla.org/en-US/docs/W...
You could try Z.
dev.to/kayis/pattern-match-your-ja...
Z looks interesting for sure. It's a little limited though. But it would work fine for this use case.
Glorious! I love the idea.
I'm not a super big fan of hooks, I still prefer HOC, so for those who are interested, here is a similar alternative I am testing out.
Alternatively, a HOC would work just as well, and be decoupled.
HOCs are another great way to solve this. Great examples!
I think it would be nice to have a
refetch
action so that the request can be remade even to the same url.Also I think it would be nice to be able to distinguish then between the initial fetch, and future updates.
Also im debating with myself if I like the separate callbacks for each case, or if I would prefer being given the loading, data and error props together, and then do a more imperative approach with conditions. It seems more flexible.
In that case I would make the
render
function separately available, instead of wrapping it around thedata
Something along the lines of the react-apollo
graphql
HOC andQuery
component etc, but then for REST.All great features! Submit a pull request ;)
Anyway, here it is; written in the train, so apologies for any typos ;-)
gist.github.com/patroza/4488f8fa2b...
Would love to, but where to? Where the codes at? :)
(Maybe im blind)
There's no repo for it. It was just a live stream demo :)
Nice write up! :)
Reminds me of these posts using daggy from fantasy-land
medium.com/javascript-inside/slayi...
datarockets.com/blog/javascript-pa...
nice little library that wraps it up
github.com/devex-web-frontend/remo...
One of the reasons, I decided not to make this an npm package. I figured something was already out there. I thought it would be fun to show the process.
Looks like those other libs have the same idea. I always love seeing an article with
daggy
!daggy
is actually a perfect use case for this.Cheers!
🍻
Yeah indeed a lot times there’s a solution but not a how to reach it write up or something like that so def keep coming with the process writes up for sure !! :)
That was one thing I found interesting about this process. Most of the time the ideal solution would be created ahead of time and then you would teach that process.
But it's interesting to see how you would think to get to that conclusion on your own.
I think that's the difference between live streams and tutorials. You get to see the thought process, which I really enjoy watching!
Cheers!
🍻
yah that process is fun, we used to do FP lunch sessions at an old job and refactor some current/legacy code into something we just learned or found interesting right on a big screen tv so everyone could watch and we talk thru the process.
Haha, I wrote the same thing and it was so quick that I didn't bother to post it.
I seldomly use any libraries in React, because it's so easy and quick to build them yourself. Just a hand full of small util compnents and you're good to go.
Agreed. Plus the problem with libraries is they have to cover the use cases of every application in the works. Most times your one liner function is enough for your use case.
This.
I couldn't write an equivalent to React-Router or Native-Navigation, but I don't have to. A 10line component covers the use-cases I have.
Very functional and very Elm'ish.
I've watched this talk and it covered exactly that.
Thanks for the tip! I'm saving this video to my Watch Later.
Definitely worth watching. You might find some inspiration on how to improve your React code even more :)
There's always room for improvement!
Reminds me a lot of this component package
I ran into a few different packages that did something very similar. This is the reason I didn't create an npm package. I think there are enough already.
But I thought the process would be fun, which is why I lived streamed it.
Hopefully people enjoy the process that went into making it happen.
Cheers!
🍻
I hope it was fun! Sorry if my comment implied I didn't see value in this, I totally do. I dig seeing the thought process behind the code in addition to the code itself. Have a good one!
No your comment didn't imply that it wasn't fun. I got you ;)
You too!
I'd probably use ReasonReact for this :D
ReactReason is a very interesting project. It's hard to convince large companies to switch to a totally different language though.
I'm still looking forward to playing with ReasonML for some personal projects.
Your code is subject to race conditions.
See dev.to/sebastienlorber/handling-ap...
You'd rather use a lib that solves it for you with all the edge cases, like github.com/slorber/react-async-hook
Yep this is correct! Any previous
fetch
needs to be aborted.Since this code was just for fun, I don't think I'll be spending the time to add these cases into it. But if someone wants to contribute a gist, i'll gladly link it.
Cheers!
First time that I "unicorned" article! Well played Sir!
I'm so honored 😁
Scala-js allows writing react components this way
This sounds pretty cool. I haven't seen scalajs but if it has pattern matching I'm down!
What if you want to render a loader while new data is loading? That means you'd render a loader + the current data at the same time. Same with errors.
Submit a pull request ;)
Wow!
Cheers!
🍻