DEV Community

Chandrasekar Kuppusamy
Chandrasekar Kuppusamy

Posted on • Originally published at Medium on

Props and State in React Native

What is Props?

Props can be referred to something that can be changed dynamically in a Component (i.e Ideally, passing parameters through constructor in JAVA). Let’s discuss more on this by comparing JAVA with React Native.

Code Usage:

  1. Destination Class: (Class which receives props data)

2. Source Class: (Class which sends props data)

What is State?

State is nothing but a triggering method which is used to refresh or update values in the Component. Each time when ‘ setState ’ is called, the render() function in a Component will be called simultaneously.

Code usage:

The above code snippet creates the Button component with the initial text as “ Failure ”, and the text is replaced to “ Success ” using ‘ setState ’ function when the button is clicked or pressed.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay