Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
How do I visually format React button components?

I'm trying to make a basic calculator with React and am having trouble figuring out how to format the buttons in the typical format (ex: "0 . =" on the bottom row, '1 2 3 +' on on the next row up and so on..) with React and Bootstrap.

I have the functionality working but keep running into errors when I try to use a grid ( etc.). Any recommendations on how to approach this? (New to React)

    render() { 
        //object destructuring
        const { onReset, buttons, onPress } = this.props;

        return (
            <div>
                <button
                    onClick={onReset}
                    className='btn btn-primary btn-sm m-2'
                    >
                        Reset
                </button>

                {buttons.map(button => (
                    
                    <Button 
                        key={button.id}
                        onPress={onPress}
                        button = {button} 
                    />
                ))}
            </div>
        );
    }

Edit in response to @lucasvw 's comment:

I attempted to wrap the .map method in . 'button not defined' was the error.

    {
        <Container>
            <Row>
                buttons.map(button => (
                        
                    <Button 
                        key={button.id}
                        onPress={onPress}
                        button = {button} 
                    />
                ))
            </Row>
        </Container>
    }

I also attempted to build a for loop to spit on button out at a time. I don't have that code handy, but I believe it was a series of unexpected expression errors.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!