У меня есть простое приложение React, где я хочу использовать модуль react-timeago
npm
, и я посмотрел документацию, где есть функция, которую я хочу использовать
formatter (optional)
A function that takes four arguments:
value : An integer value, already rounded off
unit : A string representing the unit in english. This could be one of:
'second'
'minute'
'hour'
'day'
'week'
'month'
'year'
suffix : A string. This can be one of
'ago'
'from now'
epochSeconds: The result of Date.now() or the result of a custom now prop.
nextFormatter: A function that takes no arguments and gives you the result of the defaultFormatter using the same arguments above.
в документации это отображается как опора, но как я могу передать аргументы функции как реквизиты?
<TimeAgo date={this.state.time} formatter={/*how can i pass in the arguments to the function */} live={true}/>
Я вызвал компонент здесь, но у меня есть сомнения по поводукак передать в правильные реквизит для компонента?