I have the following initial state in the reducer:
(我在reducer中具有以下初始状态:)
const formatTypesDescriptions = [
{
title: 'Calendar',
intro: <p>Calendar displays time <code>relative</code> to the <code>date picked</code>.
<a onClick={() => console.log('Toggle Calendar') }>Click Here</a> to open the calendar</p>
}
]
const initState = {
formatTypesDescriptions,
calendarIsVisible: false
}
const customVariables = (state = initState, action) => {
switch (action.type) {
case TOGGLE_CALENDAR_VISIBILITY:
return {
...state,
calendarIsVisible: !state.calendarIsVisible
}
default:
return state
}
}
I know it's an anti-pattern in redux to call an action from the reducer.
(我知道在redux中调用reducer的动作是一种反模式。)
My problem is that the descriptions may be localized in multiple languages, so i should add multiple objects of that description in multiple languages including a link.(我的问题是,描述可能会以多种语言本地化,因此我应该以多种语言(包括链接)添加该描述的多个对象。)
How can i handle the event from the jsx element in the app's state?
(如何在应用程序状态下处理jsx元素中的事件?)
ask by Ali Kleit translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…