Two recent books offer one answer: it helps to have grown up battling the racism and institutional failures of 1990s Los Angeles.

Both books are compelling memoirs from African-American women and southern Californians, now in their 30s. But the authors are very different. One is Black Lives Matter co-founder Patrisse Khan-Cullors, a deeply serious activist whose memoir, “When They Call You a Terrorist,” quotes Nelson Mandela. The other is movie star Tiffany Haddish, a profane comedian whose memoir, “The Last Black Unicorn,” offers an excruciating exegesis of discovering a sex tape of her boyfriend cheating.

But both the women show how to turn the pain of Los Angeles into national power. In their telling, the worst of L.A. — its discrimination, neglect and awful public agencies — helped forge strong identities, while L.A.’s best — its diversity — shaped their ability to speak to the broadest audiences.

Both women learned bitter lessons in the San Fernando Valley. Khan-Cullors recalls growing up in a Section 8 apartment in a poor Mexican-American corridor of Van Nuys. Haddish, a south L.A. kid, was bused to school in Woodland Hills. Both were from families that fell out of the middle class during the deindustrialization of the 1980s.

In the Valley, both must reckon regularly with wealthy white people who are unaware of their privilege. Khan-Cullors goes to a Sherman Oaks school, where one friend’s father turns out to be the slumlord who won’t repair her family’s apartment. She is arrested inside her classroom at age 12 for no good reason.

Haddish, also attending schools with wealthy whites, seizes the opportunity, developing a business providing entertainment at bar mitzvahs.

Both women give much credit to their Los Angeles Unified public schools. Khan-Cullors’s teachers at Cleveland High introduce her to concepts of social justice. One of Haddish’s teachers at El Camino Real High helps jumpstart her academically; New York University offers her admission, though not enough scholarship to attend.

But outside of school, both learn that L.A. doesn’t really care much about the lives of its kids—especially black, poor ones.

Khan-Cullors watches her friends get arrested for minor acts—tagging, cutting class and wearing the same T-shirts. She sees how the drug war, the “three strikes” law and gang injunctions falsely label and injure her friends. The book is powerfully infuriating in recounting how Khan-Cullors’s brother, Monte, a schizophrenic, is charged with progressively more serious crimes (including terrorism), even though he doesn’t physically harm anybody.

Khan-Cullors fights to protect her brother from institutions, especially the L.A. County Sheriff’s Dept., that treat him as disposable. The line to her eventual activism is clear: Wouldn’t Monte have received necessary care, rather than abuse and incarceration, if all black lives really mattered?

In Haddish’s memoir, it is the author herself who suffers the abuse. She is beaten by her mother, as well as in the foster care system, in which she spends her teens. She falls into difficult relationships with men as a result.

“I end up picking jealous and possessive guys, because in some sick, twisted way, I think that means they care,” she writes.

In the face of awful realities, both women see few options but to assert themselves. Khan-Cullors builds a commune of activists and artists, defying police raids. She finds that having had to navigate sprawling and diverse L.A. helps her build the decentralized Black Lives Matter.

Haddish fights racism and sexism as she breaks into comedy. But she is lucky in that her unlucky childhood has made her tough. In 2017, she breaks out in the film “Girls Trip.”

Ultimately, both books make the same timely point: you can’t compromise with people who discriminate against you.

Black Lives Matter is often criticized as advancing narrow “identity politics.” That’s backward. Khan-Cullors and Haddish show how forging a strong identity—even through suffering—allows you to speak to universal values.

“That’s why my comedy so often comes from pain,” Haddish writes. “In my life, and I hope in yours, I want us to grow roses out of the poop.”

Joe Mathews writes the Connecting California column for Zócalo Public Square.