American race relations are taking two very different paths at the same time. On the one hand, we’re seeing growing mainstream acknowledgment of black pride projected through art: Beyoncé’s widely praised performance at the Coachella arts festival, Kendrick Lamar’s Pulitzer-winning album, and even the record-breaking commercial success of Marvel’s “Black Panther.” On the other, racism and xenophobia are exerting tremendous influence in national politics.

While this may seem odd, it’s actually a modern twist on something we experienced almost a century ago, during the Harlem Renaissance. Black artists in the early 20th century responded to overt racism with cultural productions that proudly displayed racial pride. The main difference is that today’s artists are sharing their culture with a much wider, more diverse and more receptive audience — which offers them a significant opportunity.

Beginning in the first decades of the 20th century, the Harlem Renaissance represented an explosion of black pride communicated through the arts. It stood as a response to Jim Crow segregation, the web of laws, practices, traditions and attitudes that reduced black Americans to second-class citizens.

Overt racism ran rampant, and political leaders were either boldly supportive or impotent to stop it. Terrorist organizations such as the Ku Klux Klan policed the color line through violence. Black Americans lived in fear of lynching, which was tacitly condoned by white Americans who refused to punish the perpetrators.

Indeed, the gathering of black artistic talent in Harlem resulted, in large part, from discriminatory housing practices imposed upon black Americans as they moved north during the 1910s. Informal agreements between real estate buyers and sellers who refused black patronage were later compounded by the Depression era practice of “redlining.”

By the 1930s, the impact was an effective system of racial exclusion, albeit less overt than the one in the Jim Crow South. The artists of the Harlem Renaissance condemned this oppression, offering philosophical-spiritual sanctuary decades before the civil rights movement of the 1960s offered political refuge. Although the nation’s attention was eventually directed toward resolving the crises of the Great Depression and World War II, Harlem Renaissance artists used their gifts to articulate and protest the challenges of their day.

In his poem “Ballad of the Landlord,” Langston Hughes illuminated the struggles black Americans faced in trying to find decent, affordable housing. Claude McKay drew attention to the scourge of lynching in his poem “The Lynching.” In her autobiographical essay “How it Feels to be Colored Me,” Zora Neal Hurston expressed her views on the conundrums of navigating the duality of being both black and American. W.E.B. Du Bois, a prominent spokesman for the NAACP, performed invaluable service as editor of the Crisis, keeping people informed about social plagues from lynching to voter discrimination. The magazine also became a major outlet for black artists and writers to present their views.

These artists offered a counterpoint to the stereotypical portrayal of blacks as inept, harmless clowns, as they were depicted in minstrel performances and even on the big screen. To achieve stardom in this era, black actors such as Hattie McDaniel, who played Mammy in “Gone with the Wind,” had to feign intellectual dullness, hiding their true intelligence and feelings from whites.

The Jim Crow-rooted struggles that accomplished black artists, athletes and intellectuals confronted gradually diminished over the next half-century, as the civil rights movement pushed the federal government to remove the legal barriers that had made African Americans second-class citizens.

The move away from overt political discrimination opened the way for black singers and actors to ascend to new heights. During the 1960s, Sammy Davis Jr.’s unique membership in the popular “Rat Pack” — a group made up of Frank Sinatra, Dean Martin, Peter Lawford and Joey Bishop that played to sold-out crowds in Las Vegas— showed how African Americans could forge artistic progress beyond the roles of shuffling man-children or dutiful maids. Diahann Carroll’s leading role in the television series “Julia” likewise indicated that African Americans could move beyond the artistic confines imposed by stereotypes, and also highlighted the growing prominence of black women in popular media.

Progress has been uneven, and black actors still struggle to find substantive, non-stereotypical roles. Nevertheless, African American artists, actors and musicians gained broader acclaim during the 1960s and 1970s. Their increased cultural clout didn’t stop them from speaking truth to power and shining a light on the contemporary lived experiences of black Americans — who still confront hurdles mostly foreign to white Americans. If anything, the persistent impact of race in the daily lives of African Americans moved artists to speak more frankly of its manifestations

Musicians did their part in confronting racist attitudes and policies, offering alternatives to mainstream narratives of black pathology. Curtis Mayfield and the Impressions’ 1969 song “Choice of Colors” challenged the racial strife of the late 1960s and early 1970s with lyrics highlighting the tragedy of America’s preference for categorizing people by race rather than their shared humanity. Bobby Womack’s 1973 song “Across 110th Street” addressed the ongoing social and economic decline of the nation’s inner cities and the deleterious impact upon African Americans. And in his 1991 song “Brenda’s Got a Baby,” Tupac Shakur spoke directly to the gross educational disparities, teenage pregnancy, rampant unemployment and crime that plagued urban communities.

Today, artists who challenge racism through their work are among the most acclaimed in American music. Hip-hop has gone from drawing the ire of politicians to being used by them to win votes. Kendrick Lamar became the first rapper to win a Pulitzer over the classical musicians who traditionally receive the award. Beyoncé’s 2016 album “Lemonade,” widely viewed as a celebration of black femininity and power, sold nearly a half-million copies in its first week. The Rev. Martin Luther King Jr.’s hopeful vision of people being judged by the content of their character rather than the color of their skin has been manifesting itself in ways that opened the possibility of such developments.

Even so, progress toward King’s vision has not negated the power of lingering attitudes and perspectives that are just as invested in ensuring that society remain fractured, both socioeconomically and politically, on racial lines. President Trump’s election and naked appeal to hateful, bigoted elements of society are grim reminders of the work yet to be accomplished. Trump’s refusal to condemn racist, xenophobic behavior has emboldened racists and bigots, who through his administration have reasserted their prominence in American life.

And like the artists of the Harlem Renaissance, stars such as Lamar and Beyoncé are using their art to oppose these currents in contemporary politics. In many ways, their art builds upon the efforts of earlier luminaries by sounding similar themes. Like the artists of the Harlem Renaissance, they help foster a sense of community, brashly reject twisted caricatures of black people and serve as motivational founts from which blacks draw energy to persist in their struggle for dignity and full citizenship.

They assure us that people of prominence are willing to stand against the purveyors of hate and division. They prove that, while courage may be in desperately short supply in Washington, there are those who refuse to be cowed by bullies and the malice of their rhetoric.

Much of the power possessed by contemporary artists resides in their ability to choose the unique times, places and methods by which they resist the demagogic tendencies of the moment. For all the strife and mean-spirited toxicity fueled by Trump, contemporary artists have the reach and following to make strides toward ending the demagogic influence that has thrived on the power of hate.