Simple react knowledge

  node.js, question

I want to judge whether the user has logged in first under componentWillMount. If the user has already logged in, the user name will be displayed, but if not, the user name will not be displayed.

How to Control render Function Rendering under componentWillMount?

You should first define a state, assuming user, with a null initial value.
The render function determines whether user is null. If it is null, the user name will not be displayed, and if it is not null, the user name will be displayed.
Then componentDidMount judges whether to log in or not and logs in setState({user: User Data})