0

My react native app is working ok, but now need to add code push,

my question is where to add the

CodePush

On the "App"

Here my code,

const App = () => (
  
  <Provider store={store}>
    <NavigationContainer>
      <SafeAreaProvider>
        <View style={styles.container}>
          <Main/>
        </View>
      </SafeAreaProvider>
    </NavigationContainer>
  </Provider>
);

// let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

// App = CodePush(codePushOptions)(App);

export default App;

But if I uncomment

let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

App = CodePush(codePushOptions)(App);

export default App;

is Crashing...

How to properly add the CodePush to my App?

2 Answers 2

2

You dont have to set the value to the App, you can directly return like below

let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

export default CodePush(codePushOptions)(App);
Sign up to request clarification or add additional context in comments.

Comments

0

You need to declare a new variable. You cant use App because App is already declared and used.

MyApp = codePush(App);
export default MyApp;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.