C
C
Cyberial Syntwaiser2019-11-10 20:36:54
React
Cyberial Syntwaiser, 2019-11-10 20:36:54

What is *propTypes* type checking, what is it for? How to use in reality?

Good time! Guys need help, ran into this code

class PageContainer extends PureComponent {
  render() {
    const {
      children,
    } = this.props;

    return (
      <section className='PageContainer'>
        {children}
      </section>
    );
  }
}

PageContainer.propTypes = {
  children: PropTypes.node,
};

Well, first we make a variable to add properties to react for all components? *const {
children,
} = this.props;*
Then we display some content with this property *return (
{children}
*
What is the last thing? How does it work in place? Maybe I'm still stupid and write nonsense?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lnked, 2019-11-10
@Cyberial

Read about type checking

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question