The Dacha Beer Garden on Q and 7 th streets is a popular hang out for the new residents of Shaw, an historic black neighborhood in D.C. (Astrid Riecken/For The Washington Post)

Street crime in moderate doses doesn’t deter white millennials from swarming to take over traditionally black urban neighborhoods. On the contrary, they take pride in moving into an edgy, “authentic” community — and even brag about the violence.

That’s what American University professor Derek S. Hyra argues in his new book, “Race, Class, and Politics in the Cappuccino City,” about gentrification in the District. At one point during his four years of field research in the Shaw/U Street neighborhood, he attended a local fundraiser where white recent arrivals seemed to boast about crime in their adopted neighborhood.

“They described neighborhood carjackings, shootings, and purse snatchings with laughter and jokes,” Hyra writes. “It seemed that the neighborhood violence gave some newcomers ... something interesting to talk about at parties.”

Hyra’s book applies a sophisticated, academic approach to studying social tensions at the forefront of current politics, development and culture in the District.

Richard Williams, 66, the unofficial mayor of 7th Street in the rapidly changing Shaw neighborhood of Washington DC, greets a neighbor outside of "The Hodge," his apartment building in Shaw on Nov. 15, 2016. (Michael Robinson Chavez/The Washington Post)

The book raises an ominous warning about a cherished dream of District politicians and activists: that they can build neighborhoods that achieve harmony among diverse races and economic classes.

Instead, Hyra found that when mostly white millennials move into traditional African American communities, the two groups interact little and frequently chafe with each other.

For instance, the young, affluent newcomers tend to take over political and civic organizations and promote their own interests — a phenomenon on display in the recent explosion of bike lanes, dog parks and upscale coffee shops.

Many older, working-class blacks are able to remain, because of the District’s progressive affordable housing policies, and they welcome some benefits, such as a decline in crime.

But they also resent giving up both their former political influence and the character of their community. In one case, lobbying by new arrivals cost black churchgoers a long-standing convenience of parking in a school playground on Sunday mornings. Small, black-owned businesses that served as public gathering places have shut their doors.

(Adriana Usero/The Washington Post)

Longtime residents “basically feel lost in the neighborhood they grew up in,” Hyra said in an interview. “We haven’t built bridges between people in diverse populations who are living next to each other.”

Hyra, who is white, is director of the Metropolitan Policy Center at AU’s School of Public Affairs. His research included a year volunteering for a grass-roots group, ONE DC, that advocates for low-income people in Shaw.

In one of the book’s most eye-opening chapters, Hyra casts light on a pair of phenomena — “black branding” and “living the wire” — that reveal a lot about racial dynamics in early 21st century America.

“Black branding” describes how developers and other mostly white business interests actively promoted Shaw’s historic black identity as a marketing strategy to attract white renters and buyers. Their success helped tip the neighborhood’s demographics from 70 percent black in 1970 to 30 percent in 2010.

The Shaw/U Street area was an ideal candidate for such a sales job. U Street was known as the “Black Broadway” in the 1920s and 1930s, and the neighborhood nurtured cultural giants including musician Duke Ellington and poet Langston Hughes. Both are now memorialized in names of plush residential properties--”The Ellington” and “Langston Lofts.”

The advertising pitch represented a dramatic shift.

“Not long ago, an urban community’s association with blackness was mostly perceived as detrimental,” the book says. “But nowadays ... neighborhood-based organizations, real estate developers, restaurant owners and urban planners commodify and appropriate aspects of blackness to promote tourism, homeownership, and community redevelopment.”

Hyra dubs a related trend as “living the wire” where whites in their 20s and 30s seek the titillation of living in a community with a hint of the urban grit of the Baltimore ghetto portrayed in the TV series “The Wire.”

He also faults the practice as a new form of urban slumming.

“Living the wire refers to newcomers’ preferences for moving into an inner-city neighborhood because it has been branded as hip or cool, which, to a certain extent, is associated with danger, excitement, poverty and blackness: iconic ghetto stereotypes,” the book says.

Although whites may relish “living the wire,” Hyra says, African Americans unhappy about crime are “living the drama” of residing in a dangerous community.

Hyra’s findings represent a challenge to the housing and economic development strategies advocated by the city’s elected officials and urban planning advocates. Their goal is building communities with a broad mix of races and income groups.

Mayor Muriel E. Bowser (D) sums up that approach by calling her program “inclusive prosperity.” One of her signature objectives is preserving affordable housing in gentrifying neighborhoods.

Partly as a result of such policies — also pursued by Bowser’s predecessors — the District has had more success than many cities in allowing low-income residents to remain as their neighborhoods transform, according to Hyra and local housing experts.

Without support from the city and churches that sponsor subsidized housing, Hyra said, blacks’ share of Shaw’s population would be a third of what it is today.

But while the groups share physical proximity, they remain isolated from one another in a pattern that Hyra calls “micro-segregation.”

The divisions break along more than racial lines. The neighborhood also has experienced frictions between conservative, religious residents and gays, and between upper-class and lower-class African Americans.

“While there are signs that we are becoming a more tolerant society, preexisting social categories, such as race, class and sexual orientation, help to explain intense neighborhood conflicts,” the book says.

What’s the solution? Hyra urges creating more “third spaces” like corner stores and recreation centers where all groups can feel comfortable. He also wants more funding for non-profits that encourage community cooperation and more subsidies for long-standing Mom-and-Pop businesses.

It’s not clear that such steps would be sufficient. But they would be necessary if the District is to fulfill its aspiration of seeing black and white, rich and poor, enjoy the city together.