skysight-inc/HackerNews huggingface dataset:
I have been doing React development for a good amount of time now and I really like what hooks allow. It does diverge a bit from classic OO ideas though, which can be tricky to wrap your head around the first time.

Hooks do a good job of nudging you to make better decisions about how to design your app, primarily by making bad decisions harder to make. This feels bad initially but once you get it, I think its better.

That said, lets address your issues:

1. Yes/No. There is no reason you cannot have both props and state effect your component, however I don't think thats your question.

If you need something outside the component to effect what is typed into the box, (e.g. the app can clear the text) then yes, you should be passing the text in as a prop, along w/ an onChange callback prop for when the text is changed within the component. I think of it as, if the state can be changed somewhere else then it doesn't belong to the component, and is thus a prop. Note, the options could be filtered in the component or not, also up to you.

2. I agree with this question. The main use I've found of useCallback is to avoid triggering changes to other hooks. ¯\_(ツ)_/¯ I think react team members have even asked about how people use it: https://twitter.com/brian_d_vaughn/status/117435997560009113...

3. useRef is great. It allows you to store state which does not trigger re-renders. This gives you a finer detail control of your component. I would not use it to "hack around the fact that state changes don’t take effect until the next tick" though. I think it would be bad practice to have to think about when state changes take effect. (This might be one of the "making bad decisions harder to make" moments)

P.S. I agree about typing .current everywhere, but it makes sense from a JS perspective. useRef is simply keeping track of an object instance and you are accessing a member of that object. I'm not sure if it has to be 'current' or if thats just convention (anyone know?).

4. I can't answer this without an example. Generally, if you need the value to render, you either have it via a prop or it it is already stored in state. If you need to transform that value in order for it to look right, you do that inside your function. If it is a complicated calculation, do it with useMemo, so it only has to be done if your value changes.

If something causes your state to change, you should just update the value and then allow it to rerender, thus it becomes the already in state case. Those changes should really only be part of other actions though, not your render function itself.

So that was long winded, but hopefully useful. I think hooks are good and generally use the following heuristic:
- useState: state which causes rerenders on change

- useRef: state which does not cause rerenders on change

- useMemo: calculated state based on other props/state (only needed if the calculation is expensive)

- useCallback: useMemo for functions :p

- useEffect: Do something based on state or lifecycle of component (e.g. mount/unmount)

(edited for formatting)
Ask HN: Are there any good React UI Wysiwig builder tools?
I feel like hand-coding things from scratch (even while using a framework like material-ui or ant) is really not that efficient. I find it super hard to make my prototypes look 100% professional/sleek. It feels like there must be a drag and drop like tool where I can design a bunch of screens, export the components, and then go in and setup functions, state, props, data, context/redux, etc. Am I wrong in this hope? It seems like a design tool like Canva made it so easy for non-designers to make nice ads/postcards. Is there not something similar for the web/mobile app making world?
So I've looked into Figma to React (seems extremely experimental), pagedraw.io (shuttered and open sourced earlier this year), and React Studio (seems like more of a UX tool). My googling and searching past reddit threads isn't yielding anything. Searching youtube tutorials hasn't either.
Is there a good tool or workflow to achieve what I mentioned above? How does one go from attractive figma/sketch mockups to a series of 'smart' and stateful react components?
The Making of the American Gulag
The problem is that most people would need to look in the mirror.

Do you have a 401k? Do you plan on having a retirement? Then infinite growth needs to be a thing, otherwise that 7-9% a year that people think they are "guaranteed" from index funds would evaporate. If people couldn't make money off of passive investments it would turn the entire economy upside down.
Weird. Yesterday, people on here were accusing Apple of bowing to the Chinese for this exact same app.
> I honestly don't see how dogs even make any sense in a city for people who don't have cars.

Why would you think that dogs that live in the city get any less exercise than a dog who lives in the suburbs or somewhere rural? Often cities are more walkable than the alternative.
Just to be clear, I agree, and I think what the person I'm replying to did is totally kosher. But I just think the fact that my password is private should not just be within technical limitations. If you find my password is "hurtmedaddy" I have a reasonable expectation to privacy about that beyond what SHA can and can't protect me from, and I would hope it's not showing up in some weekly report to be shared with IT. A hacker might find it anyway, but certainly my boss certainly shouldn't have to.

edit: And back to technical concerns - someone knowing my password leaves a hard-to-audit window in which I am even less secure. Force-resetting the password in automation instead of revealing it would be better. Sharing it more widely before the problem is fixed increases the risk.
That is true, I created a college website in 2009, it used legacy MySQL drivers and ie6 compatible code.

Every year I go back to visit the url, it works flawlessly with latest content. They even didn't bothered to change admin creds till 2017.

Site is still up and running
Very anemic list. For example, only one person from GCC steering committee (Ian Lance Taylor)
“Providing a gateway for ‘toxic apps’ is hurting the feelings of the Chinese people"

Awww, your feelings got hurt? Care to think about the feelings of a million Uighur people that are being tortured in concentration camps? Or the 7 million Hongkongers that you've been trying bully into submission?
His criticisms apply to capitalism, not technology. If you accept the Milton Freedman position that corporations have as their sole duty the enrichment of their shareholders, this is what you get.
Why Machine Learning Is Critical for Disaster Response
True. The recent trend of regular people demanding online platforms to remove "fake news" or other offending content has been quite worrisome, mainly because we don't know where it will end. The US government is already trying to take advantage of this by conflating the encryption debate with the content moderation debate.

https://www.techdirt.com/articles/20191007/00022343132/doj-i...
Sorry maybe I'm not explaining what I want to very well.

On the Mac it will suspend to RAM but also dump to an image file at the same time. If the mac runs out of power it will later restore from the image once power is restored.

That's possible on Linux using hybrid-sleep and suspend-then-hibernate but they require a swapfile.

I haven't yet found a way to have a swapfile without allowing that swapfile to be used for virtual memory too. I worry that virtual RAM will eat my SSD.
A lot of new Indian immigrants start out liberal and Democrat, and eventually start moving towards the Republicans - almost entirely on fiscal policy. The culture wars the GOP base cares about does not echo with the Indian diaspora.

Issues they do care about, and which is likely true of most immigrant groups:
- Immigration laws. A lot of Indian arrivals are quite educated, yet struggle with the current system to enter the US. Many favour the Trump plan for a merit based visa regime.
- Foreign policy towards India and Pakistan.

Modi's popularity is a distinct formulation, and has to do with complex ideas of identity within multi-ethnic India. Only a tiny sliver of Modi's popularity has to do with his policies, and more with his Strongman persona.
This might be a noob question but can someone explain me how mailing lists are used in software projects. I keep seeing these archived emails that are posted. Could someone fill me in?
True, but it hurts more when it's a company with such a great history and strong relationship with its customers.

I think people don't really care about what Nestlé or Monsanto do because they've never really cared about those companies, but people care about Blizzard.
> United States does not want to be talked about 911

As a US citizen, please talk about 9/11. The response Americans had in the wake of that tragedy is reprehensible - the entire country gave unanimous support to the government to commit war crimes in nations around the world - including our own. Torture, illegal detainment, wars founded on lies to make private contractors rich, expansive laws like the Patriot Act, NDAA expansions, and establishment of the Department of Homeland Security, all of which grossly violate civil liberties and privacy.

The rest of the world should criticize America for 9/11, for being responsible for the destabilization of countries that led to such a degree of organized terror in the decades leading up to it, as much as we should be criticized for the heinous acts domestically and abroad committed in response to it (or at least, that were excused by it).
I read this bit as an emphasis on the unfair punishment. It's one thing for Blizzard to disqualify and ban Blitzchung. It's another thing to withhold his winnings and fire the two event commentators who let Blitzchung make his statement.
There was some interesting research in the book, “The Distracted Mind”, which showed that looking at nature could help relieve a distracted mental state — and that looking at pictures of nature could offer similar restorative benefits.

I know for me, personally, that few things come close to sitting under a tree at the park when I’m feeling drained.
I personally don't use either Uber or Lyft because of the Saudi money going into them. Same with:

Tesla, ARM, NVIDIA, WeWork, Mapbox, General Motors, Fanatics, DoorDash, and others

I'd drop Slack too if I could, but tech companies tend to mandate it.

I also stay away from companies with Chinese Beijing ownership, since Chinese Beijing isn't really any better on human rights than Saudi Arabia is. Just a few of them include:

Tencent (Riot Games, Epic Games), Blizzard, Reddit, JaGeX (Runescape), AMC, GE Appliances, Lenovo, Hoover, TikTok, and many many others

I still use my Apple devices, but I'm not buying any new ones (or any other devices manufactured in Chinese Beijing) until their production is out of Chinese Beijing and into more responsible countries like the Republic of China, India, EU nations, or America.

I have nothing against the Chinese people or the Saudi people, but their fascist governments need to be overthrown.
He sure isn’t standing up for Hong Kong. Jeez.
Um, because under Obama ICE wasn’t putting kids in cages? Because it wasn’t withholding bedding? It wasn’t separating families and then “accidentally” losing track of the children? Children weren’t dying while in jail away from their parents? They weren’t denied food and clean water?

Should I go on?
This is the purest of unsubstantive political comments. Obviously if HN comments turn into this, the forum is gone. Would you please read the site guidelines (https://news.ycombinator.com/newsguidelines.html), take the intended use of HN to heart, and stop posting like this?

You might also find these links helpful for getting the spirit of this site:

https://news.ycombinator.com/newswelcome.html

https://news.ycombinator.com/hackernews.html

http://www.paulgraham.com/trolls.html

http://www.paulgraham.com/hackernews.html

All: please don't upvote comments like this. It has no place sitting at the top of a thread. I'm going to mark it off topic now.
I feel for Taiwan.

Whatever hopes the borderline pro-China Taiwanese harbored must’ve been shattered by what is happening in Hong Kong this past year.

The true character of China has been revealed: The CCP is power-hungry and don’t feel constrained at all.

I would consider it a fight or die situation in slow motion from here on out.
Sometimes principles are worth more than the money.
Apple has bent the knee plenty of times to China.

If you really are an Android user, this should not be news. You can put any app on your device. Only Apple restricts you.
The biosphere is not about to collapse from a couple degrees of warming. The earth has been a lot hotter, there was a time you could grow ferns in the Arctic circle.

The 10 degrees warming after the last ice age makes climate change small by comparison. Let's not forget the 400ft of sea level rise. In fact if you look at the climate record the last ten thousand years, the current level of warming is lost in the noise. It will take centuries before it's enough to really jump out on the graph.

Life will adapt and carry on, climate change is possibly only a temporary blip for the earth itself. It may even turn out to be a good thing on long enough time scales, because it's been a little too chilly for comfort here the last few million years. Repeated cycles of ice ages are no joke. If you want to see how bad that can get, lookup snowball earth. Warming is no joke either, see Venus, but a little warming might not be the end of the world.

I'm Canadian, my county was buried under 2km of ice that scoured it to bedrock just as civilization was beginning elsewhere in the world. If you are in the US, you grow your food in what used to be Canadian soil. I'm more afraid of the cold than the heat. People from Australia and the middle east likely have the opposite view.
That's because most people don't understand that "freedom of speech" and "free speech", while related concepts, are actually different.

Freedom of speech is what the US Constitution guarantees. It says the government cannot limit people's ability to speak their mind, and cannot punish people for speaking their mind. Note that it says nothing about what private entities can do, especially on platforms they own and operate.

"Free speech", as exercised nowadays (mostly) by conservatives who complain about being "silenced", is the (in my opinion ridiculous) idea that one should be able to say anything they want without any consequences whatsoever, and that they are entitled to any platform they choose to spread that message. These are the same people who advocate for a "marketplace of ideas", but get bent out of shape when that marketplace reacts negatively to their opinions.

In my opinion, we need to rid ourselves of the idea that all ideas are equally valid and deserve equal amounts of airtime and consideration. Furthermore, it is okay to completely dismiss certain ideas on their total lack of merit, and furthermore take (private) action to prevent their spread. For example if I post on this site that "all people of <insert ethnicity> need to be exterminated" it would be completely okay for others here to downvote/flag my post (i.e. "censorship") and for HN to ban me (i.e. "de-platforming").
> all hail, profits before people.

GitHub is net negative $300,000 after their $500k donation, so how does this have anything to do with making more money?
Am I wrong that this motivation comes from investors valuing the total stock price (and ultimate selling of those stocks) over continued paid dividends?

This preference has always bugged me as personally I'd prefer to have a consistent trickle I can plan on than a sudden value spike I have to capitalize on, but I suppose I've always been adverse to gambling anyway.
> Stallman’s behavior over the years has undermined a core value of the GNU project: the empowerment of all computer users

The notion that empowered means shielded from opinions you might disagree with seems odd.
just as the United States does not want to be talked about 911

I'm not sure what you mean by this. In the United States there is a completely unregulated cottage industry disseminating all sorts of misinformation and conspiracy theories about 9/11. There are people who make a living doing this.
> After analyzing the user engagement statistics of apps that switched from semi-hidden navigation within hamburger menus to more visible bottom navigation bars, and apps that switched from more exposed to semi-hidden navigation, Wroblewski saw a trend. “Navigation is the manifestation of what is possible in an app and when people can’t see what’s possible, they likely won’t know what they can/should do in that app,” he told me in an interview about this idea. Increasing visibility boosts usage.

They have this highly data-driven process which optimizes for usage and engagement . The problem is I don't wake up in the morning and go "gee I really want to up my engagement with google maps today". The ideal information retrieval app consists of me retrieving information and closing it. This is antithetical to Google's monetization model, and thus Google Consumer design is not for my benefit.

That said each Google Product is like a different company and they do do good work here and there. Specifically the Google Cloud Console has improved tremendously over the years (no doubt due to massive investment). Is it perfect? Hell no. But I prefer it to AWS and Azure tremendously.
>> Morally, though

>The only ones that hold these sorts of views are the ones with nothing interesting to say.

I'm confused by your response; what is it you are trying to say?

They were making a legal description of why the 1st amendment doesn't prevent a private entity from censoring; not a moral one.

From a legal perspective, they are right. The constitution prevents the government (and only the government) from restricting speech.

If this guy was going to jail or being fined by the US Government because he said FreeHK, then that would be a rights violation.

He isn't going to jail; so, now it is up to the terms of his contract with Blizzard/EA as to whether there is a Civil or Criminal legal violation (and any applicable labor laws in whatever jurisdiction can be applied); and even if there is a legal violation, that would be a contract law issue and not a rights law issue (or a local labor law issue).
AMEX does this and it's honestly great. Unfortunately my credit union doesn't, but I use credit for most transactions anyway.
There are no facts in this case available to us, the internet commenters; only 100% framing. In a different framing, the victim is the one who was unfairly fired, perhaps due to fitting in poorly or even malicious claims of misconduct by the harasser. And in this framing you are not only blaming the victim, but also attacking everyone who doesn't.

See how this works? "Believe the victim" is circular reasoning, all it does is calcify your priors. Truth-seeking demands that one must keep an open mind and consider competing interpretations of an event.
Which fact did you "prove" false, please? Be specific.
It all sounds the same to me...the economic power structure you reference is just as tribal, made of the haves and have nots, with the have nots further dividing themselves into tribes so they don't unite against the haves. There is no productivity or stability for the have nots in the West
That password was pretty long - could be a complete windowing system written in J.
Bazel, Cabal, Stack: Why Choose When You Can Have Them All?
I wasn't aware that people in the US don't want to talk about 9/11. There have been multiple books and movies about the failure to prevent the terrorist attack, the attack itself, and years of aftermath. Public discourse about the event isn't suppressed, and even George W Bush has commented about the event while he was president and after he left office.
Though I've seen it referenced multiple times, I don't see the connection between Hong Kong's protests and 9/11.
The president asked for the assistance of Chinese government to help him get dirt on his political opponents in the U.S.

https://www.apnews.com/c4fc388b22f549e0a67925cab8cd7e93
This gave me an aha moment. It's really just an attempt at legislating mortality. But I need to ponder that.

>And when you get it wrong, correct yourself.

This is where I strongly disagree. At most, the compromise is to keep it ambiguous. Otherwise you're putting your personal belief system over mine, and expecting me to modify my outward behavior to accommodate your beliefs (and by defying my own).

Whereas my beliefs would require no outward change in behavior on your part, let alone one that you might find internally immoral. You would just have to be tolerant.

Re: the racist thing. The technical definition doesn't fit the applied use of the term. Most people the left labels racist are at most apathetic, if you leave them out of it. And I don't mean forcing them to treat everyone equally. I mean being accused of racism if you don't actively support whatever political agenda is the flavor of the week.

It's the same forced participation that draws the comparison. And it's counter productive because it fosters resentment.

>they oppose the normalisation of others

This has become some sort of fetishisation, 99% of people being called racist want normalisation through assimilation. There's no personal grudge because a person is different. It's the special treatment being demanded that people have a problem with.

>But transgender people just want to be themselves, not hurt anyone, and not get hurt by anyone.

By demanding that others go against these same principles.
You mean Diablo and Starcraft? They do cost money, yet still require access to Blizzard servers, and running on separate servers is a T&C violation, which the DoJ considers a violation of the CFAA.
Pro-tip, perform mutual authentication:

"Can you give a reference number (they will have a case number), and tell me where I can find your department's number on your website please. [Edit] I will call you back."

I've never had a bank or other financial institution have a problem with this approach. I don't give myself the opportunity to be fooled, because all of us can be fooled, it's how I respond to every single call from a business.
A very reasoned and balanced response by Nat. And interesting that they are making a larger-than-revenue-received donation to causes that offset the evils of ICE.
Especially since operating in China seems to always result in losses given the slanted playing field there.
Mailing lists are still the best async method for discussing meta issues with regards to a project, when the people who work on it span the globe.

Basically you post to the list if you have a meta issue and then everyone replies. It can get pretty tough to follow if you're using email, but most of these had (still have?) mail<->news gateways, so you could use a threaded Usenet reader to keep track of all the forks in the threads.

It's sort of a lost art with the news service being mostly gone and with threaded social media.
Search Google inside sheets and excel
Don’t let the door hit you on the way out!