์๋
ํ์ธ์, ๋ด ์๋์์ ํ์ฌ ํ์ฑ ํญ๋ชฉ์ ๊ฐ์กฐ ํ์ํ๊ณ ์ถ์ต๋๋ค. ํด๋น ํญ๋ชฉ์ ๊ฐ์กฐ ํ์ํ ์ ์๋๋ก ํ์ฌ ์ฅ๋ฉด/๊ฒฝ๋ก๋ฅผ ์ด๋ป๊ฒ ์ป์ ์ ์์ต๋๊น?
Actions.currentRouter๋ฅผ ์๋ํ์ง๋ง ์ ์๋์ง ์์์ต๋๋ค.
๊ฐ์ฌ
redux๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ this.props.route.key
๋ฅผ ์ป๊ธฐ ์ํด ์ด๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
๊ธฐ๋ณธ ๊ฐ์๊ธฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ค์์ ์ฌ์ฉํ์ฌ ํ์ฌ ์ํ ๋ฐ ๊ฒฝ๋ก์ ์ก์ธ์คํ ์๋ ์์ต๋๋ค.
const reducerCreate = params=>{
const defaultReducer = Reducer(params);
return (state, action)=>{
// The following is an example alternative implementation of Reducer.js .getCurrent(state)
var currentState = state;
if(currentState){
while (currentState.children){
currentState = currentState.children[currentState.index]
}
}
return defaultReducer(state, action);
}
};
์๋ ๋ถ๋ถ์ ๋ฌธ์์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ ๊ฒ์ ๋๋ค
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ธฐ๋ณธ ๊ฐ์๊ธฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ค์์ ์ฌ์ฉํ์ฌ ํ์ฌ ์ํ ๋ฐ ๊ฒฝ๋ก์ ์ก์ธ์คํ ์๋ ์์ต๋๋ค.