.Net application development specialists
asp.net, c#, vb.net, html, javascript, jquery, html, xhtml, css, oop, design patterns, sql server, mvc and much more
contact: admin@paxium.co.uk

Paxium is the company owned by myself, Dave Amour and used for providing IT contract development services including


  • Application development - Desktop, Web, Services - with Classic ASP, Asp.net WebForms, Asp.net MVC, Asp.net Core
  • Html, Css, JavaScript, jQuery, React, C#, SQL Server, Ado.net, Entity Framework, NHibernate, TDD, WebApi, GIT, IIS
  • Database schema design, implementation & ETL activities
  • Website design and hosting including email hosting
  • Training - typically one to one sessions
  • Reverse Engineering and documentation of undocumented systems
  • Code Reviews
  • Performance Tuning
  • Located in Cannock, Staffordshire
Rugeley Chess Club Buying Butler Cuckooland Katmaid Pet Sitting Services Roland Garros 60 60 Golf cement Technical Conformity Goofy MaggieBears Vacc Track Find Your Smart Phone eBate Taylors Poultry Services Lafarge Rebates System Codemasters Grid Game eBate DOFF

Using React Children and Props Together

In React, components can accept both the special children prop (whatever you place between opening and closing tags) and any number of custom props (like id, title, etc.). This allows you to build flexible wrapper or layout components.

The children prop is always passed automatically, but other props must be explicitly listed when you use your component. Inside your component, you can combine them however you need.


function ChildrenProps() {
    return (
        <>
            <h1>How To Use Children</h1>

            {/* Passing in both an id and children */}
            <ParentContainer id="33">
                <ChildObject />
                <ChildObject />
                <ChildObject />
                <ChildObject />
                <ChildObject />
            </ParentContainer>
        </>
    );
}

function ParentContainer({ children, id }) {
    return (
        <div>
            <h2>I am a parent (id: {id})</h2>
            <div>
                {children}  {/* children appear here */}
            </div>
        </div>
    );
}

function ChildObject() {
    return (
        <h2 style={{ border: "1px solid blue", padding: "10px", width: "200px", backgroundColor: "#EEE" }}>
            I am a child
        </h2>
    );
}

export default ChildrenProps;
    

Key Points to Remember

  • children is a special prop that contains whatever you wrap inside your component tags.
  • Other props (like id) are just normal props you must define yourself.
  • You can combine them to make parent components flexible and reusable.