Are you first timer at Why not join us and start exchange your programming knowledge with everyone. Register today!

Difference between state and props?

0 votes
added Mar 11, 2019 in ES6 by LC Marshal Captain (25,840 points)
props & state both are JS objects. Props could get across component whereas state is managed within the component (only)

1 Response

0 votes
responded Mar 11, 2019 by LC Marshal Captain (25,840 points)

props example;

import React from 'react'

class PropComponent extends React.Component {
    render () {
        return (

PropComponent.defaultProps = {
    headerProp: 'Header prop here',
    contentProp: 'Content prop goes here'
export default PropComponent; - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.