React-native-router-flux: ์„œ๋ž์—์„œ ํ™œ์„ฑ ๊ฒฝ๋กœ ๊ฐ€์ ธ์˜ค๊ธฐ

์— ๋งŒ๋“  2016๋…„ 05์›” 30์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: aksonov/react-native-router-flux

์•ˆ๋…•ํ•˜์„ธ์š”, ๋‚ด ์„œ๋ž์—์„œ ํ˜„์žฌ ํ™œ์„ฑ ํ•ญ๋ชฉ์„ ๊ฐ•์กฐ ํ‘œ์‹œํ•˜๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ํ•ญ๋ชฉ์„ ๊ฐ•์กฐ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋„๋ก ํ˜„์žฌ ์žฅ๋ฉด/๊ฒฝ๋กœ๋ฅผ ์–ด๋–ป๊ฒŒ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?
Actions.currentRouter๋ฅผ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์ •์˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

๊ฐ์‚ฌ

question

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๊ธฐ๋ณธ ๊ฐ์†๊ธฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ˜„์žฌ ์ƒํƒœ ๋ฐ ๊ฒฝ๋กœ์— ์•ก์„ธ์Šคํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

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);
    }
};

๋ชจ๋“  3 ๋Œ“๊ธ€

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);
    }
};

์„œ๋ž ๋ถ€๋ถ„์˜ ๋ฌธ์„œ์— ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰