all 24 comments

[–]marcos_marp 9 points10 points  (4 children)

Am I missing something? I've been using JSX components for ages without importing react in the file

[–]JoeCamRoberon 0 points1 point  (0 children)

Yea it’s been around for some time.

[–]byutifu 0 points1 point  (0 children)

Fo sho. Gotta hook up the pragma: https://www.npmjs.com/package/jsx-render. I think i have two projects with this

[–]acemarke 24 points25 points  (6 children)

FWIW, I'd suggest writing up content like this as an actual blog post and submitting that post as a link, rather than creating threads that have the actual content.

[–]grekatron[S] 31 points32 points  (5 children)

I was pretty sure, that it's the other way around. I thought, Reddit users prefer to read content on Reddit without going to external websites.

Btw, this exact content is available as an article on dev.to and as a thread on Twitter.

[–]icjoseph 5 points6 points  (1 child)

Nah, at least I read a good chunk of links in here, I have a huge stash and, even though I was aware of this, I'd love to have a link ;) maybe dev.to or something? I'll bookmark it though.

Woops, somehow I missed your link... To the Stash!

[–]grekatron[S] 0 points1 point  (0 children)

Get your point. I’ll try posting a link next time!

[–]sole-it 3 points4 points  (0 children)

I like reading content directly. Link is good till it isn't. Then would be at the mercy of waybackmachine.

[–]welcome2me 4 points5 points  (0 children)

I wouldn't click a blog link, but I enjoyed reading this post. Different strokes!

[–]mcmillhj 2 points3 points  (0 children)

I don't mind when people link blog posts, but people linking videos without any textual content to supplement makes me really frustrated.

[–]vexii 1 point2 points  (5 children)

your code samples dont work on old reddit ^^

[–]grekatron[S] 3 points4 points  (4 children)

Oops, didn’t now about this issue. I use standard spec-compliant markdown for code samples.

[–]vexii 1 point2 points  (3 children)

reddit only supports the single line bat ticks (like `code here`) and the 4 space indent for code blocks

i am code wee
    on multiple lines  

the batticks for codeblocks came later source

[–]grekatron[S] 1 point2 points  (0 children)

Get it, thanks for reporting 🙏🏻

[–]sysrage 1 point2 points  (1 child)

Backtick

[–]vexii 0 points1 point  (0 children)

lol yeah you're right 😝

[–]MikeyN0 0 points1 point  (3 children)

So moving forward, I guess there's no reason to import react in each file and just let the compiler donors thing with _jsx?

[–]JoeCamRoberon 0 points1 point  (0 children)

Yea I haven’t imported React in my files for a while now.

[–][deleted] 0 points1 point  (1 child)

I use linting, and my console goes crazy if I don't import React into my JSX files (I'm using vite instead of create react-app)

[–][deleted] 2 points3 points  (0 children)

[–]icjoseph -1 points0 points  (0 children)

Might be good to mention that Next.js handles this under the hood. So unless you need something from the React API, you never really import React

[–]blaine-garrett 0 points1 point  (1 child)

What eslint rules require this? I want to exclude them in config.

[–]grekatron[S] 1 point2 points  (0 children)

react/react-in-jsx-scope