A
A
Alexander2015-05-28 00:11:07
JavaScript
Alexander, 2015-05-28 00:11:07

How to save generated key for news page using React.js?

Hello!
I am doing a thing that will show views in real time using React.js and firebase, but I ran into one problem, since I have a lot of news, I need to make a unique counter for each news, this is where the questions start.
It is logically clear that you need to generate a unique id for the component for each news, I decided to take node-uuid to generate keys, that's the problem itself, it generates a new key again and again when the page is reloaded, firebase itself creates a new field.
It would be cool to pull the numbers out of reactid, because they are already unique for each news, but I could not find such a thing in the documentation that could call reactid.
Help, hint, tell me) I will be very happy

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2015-05-30
@volkov_p_v

componentDidMount: function(){
var reactId = this.getDOMNode().dataset.reactid;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question