zuobinwang
V2EX  ›  React

[新人向] react 练手项目,计算器

  •  
  •   zuobinwang ·
    Dreamerryao · Aug 14, 2021 · 3189 views
    This topic created in 1739 days ago, the information mentioned may be changed or developed.

    之前刚学习的时候写了一个计算器,看官网的计算器支持只到了 16.8,也全都是拿类组件写的

    自己最近又看了看自己之前写的代码,发现很多地方都写的好蠢,重构了一版 hooks+一些目录安排

    觉得可以让想入门的伙伴们康康

    https://github.com/Dreamerryao/React-Calculator

    11 replies    2021-08-15 15:19:38 +08:00
    learningman
        1
    learningman  
       Aug 14, 2021 via Android
    把 build 也传上来了我是没想到的
    andj4cn
        2
    andj4cn  
       Aug 14, 2021
    @learningman 哈哈哈,+1
    rabbbit
        3
    rabbbit  
       Aug 14, 2021
    0.1 + 0.2 = ?
    9007199254740991 + 2 = ?
    建议用 math.js 之类的计算
    xiangyuecn
        4
    xiangyuecn  
       Aug 14, 2021
    @learningman 开个 pages 直接访问 能少敲一个命令都是体验🐶
    zuobinwang
        5
    zuobinwang  
    OP
       Aug 14, 2021
    @rabbbit 👌👌
    zuobinwang
        6
    zuobinwang  
    OP
       Aug 14, 2021
    @learningman 哈哈哈 更新了 ignore
    zuobinwang
        7
    zuobinwang  
    OP
       Aug 14, 2021
    感谢各位 dl 的回复,添加了 mathjs,同时添加了键盘事件,欢迎反馈!
    xstress
        8
    xstress  
       Aug 14, 2021
    向大佬学习下哈哈哈
    christin
        9
    christin  
       Aug 15, 2021 via iPhone
    我以为你是写着玩 没想到真的引入了 jq……
    zuobinwang
        10
    zuobinwang  
    OP
       Aug 15, 2021 via iPhone
    @christin 我也想了解一下其他的方法 mmm 如果有在 public 传入配置文件的需求其实还真不太好弄
    7gugu
        11
    7gugu  
       Aug 15, 2021
    0.1 * 0.1 经典裂开,可能要用更好的数学库做计算部分了哈哈😂。做得挺好看的👍
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1023 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 19:21 · PVG 03:21 · LAX 12:21 · JFK 15:21
    ♥ Do have faith in what you're doing.